質問

My sessions directory is very large and I would like to count how many files are made by each separate user (each domain).

Is there an option (with ls maybe) to count (not to list) total files made by a given user ?

I know that ls -alh dir_name lists all files and user is on one of the columns.

And also that this counts all files: ls -1 dir_name | wc -l

Maybe command can be adjusted to do a search on the column containig the username, and then count the results?

役に立ちましたか?

解決

If you know the username, this should work for you.

find dir_name -type f -user 'username' | wc -l

他のヒント

Something like:

 ls -alh dir_name | awk -F " " '{ print $3;}' | sort | uniq -c

is pretty close to what you want.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top