The du command in Linux (disk usage) will provide a detailed list of disk usage.
It is very useful for determining where the available disk space went, so you can investigate which directory is consuming the disk.
If we don’t pass a directory as a parameter, it uses the current directory as a search base.
The most common options are:
Examples:
$ du —h /home 2M /home/Carla 4M /home/Cristiane 5M /home/Guilherme 1M /home/michel
With the -sh option, it shows the totalizer, including the subdirectories:
$ du —sh /home 12M /home
With the -Sh option, it shows the totalizer, excluding subdirectories:
$ du —Sh /home 1k /home
If you want to know the total of each subdirectory:
$ du -sh. /*/
291M. /carlacru/
173M. /freud/
142M. /mario/
181M. /odonto/
273M. /office/
The –inodes option shows the inode count:
$ du -s --inodes. /*/
75. /challenge/
15. /funnel/
2. /music/
You can investigate the entire disk, from the root/:
# du -sh. /*/
221M. /bin/
125M. /boot/
0. /dev/
32M. /etc/
12G. /home/
513M. /lib/
219M. /lib64/
0. /media/
0. /mnt/
120K. /opt/
0. /proc/
145M. /root/
420K. /run/
43M. /sbin/
0. /sys/
21M. /tmp/
527M. /usr/
2.8G. /var/
Note that pseudo-file systems such as /proc, /dev, and /sys do not take up disk space because they are actually abstractions of the Kernel and subsystems.
The sudo command on Linux executes a given command as if it were another user.…
The ss command on Linux is extremely useful for investigating sockets, providing various information about…
Free Linux command shows the amount of total memory in use and available, as well…
The shell has structures for testing conditions and executing certain program sequences several times (loop),…
The /etc/fstab file stores the configuration of which devices should be mounted and what is…
The Netcat Command in Linux or nc is a utility used to do “almost anything”…
This website uses cookies.