In this article, we have provided the command to check the space used by different users in a Linux system.
Table of contents:
- Check space used by different users in Linux
- Understanding the command
Check space used by different users in Linux
The command to check space used by different users in Linux is:
cd /home sudo du -sch *
6.4G ue 90G aditya 149M jack 5M benjamin 16G geoffrey 9G dem 122G total
In the above output, there are 6 users in the system and the space occupied by each user account is specified in each row.
The directory "home" has sub-directories for each user. The same command can be used to find the space occupied by different directory in present working directory (pwd).
Understanding the command
du command is to find "Disk Usage". With the du command, we have used 3 options named sch which have the following use:
- -s: summarize: displays only the total of each argument
- -c: total: returns a grand total of all results
- -h: human readable: print size in human readable formats in units like kilobyte, megabyte, gigabyte
To get only the total space occupied by all users, the command will be:
To find the space occupied by users in bytes, the command will be:
With this article at OpenGenus, you must have the complete idea of how to find the space usage by different users. Accordingly, you can ask a specific user to free some space.