Total Disk usage for a particular user

There are different commands like du, quota or find that can be run to find disk usage for a particular user. But those commands needs to be executed with particular parameters so that it displays the disk usage for a specific user in a Linux system.

du command: du command can be used to find the size of folders and files under the user’s directory and it won’t display the files owned by the users in the other directory.In case if you are looking to find all the users then you should use either find command or quota command

du -sh ~
disk usage


find command: This is another command which can used to find the size of the files owned by the user across all directories in a linux system. This involves searching for the files and reading the file size and displaying the sum of all the files owned by a particular user (This is one that would be useful for most of our scenarios)

##All directories in the entire system
find . -user username -type f -printf "%s\n" | awk '{t+=$1}END{print t}'

##Incase if you want it only for a particular directory
find /home/ -user username -type f -printf "%s\n" | awk '{t+=$1}END{print t}'

This will display the file sizes as shown below

disk usage

What the above code does is m it uses find to count all the files in different directories and then uses array in awk to count the totals.



quota command: This command allows you to view as well as set quotas for a user and groups in a Linux operating system. If the quota is enabled then you can use the quota to display the filesystem occupied by a particular user otherwise you may need to use any one of the above commands.

#quota command where username should be replaced with the actual username
quota -u username
disk usage

As shown in the above screenshot, the quota command will display the quotas used by a specific user.

You may also like...