Search code examples
linuxcommandfilesize

Check total file size of a specific directory for a specific user


I want to check how much of the total file storage for a specific user has been used on a specific directory. I am using ls -lR ./* | grep userid to list files belonging to a specific user. But then how I can get the total file sizes of them?


Solution

  • Use awk

    ls -lR ./* | grep userid | awk '{sum = sum + $5} END {print sum}'