문제

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