"du" - Display Disk Usage of Directories

This section provides a tutorial example on how to use 'du' command to display disk usage of any given directories on Linux systems.

To see how much disk space is used by a given directory, you can use the "du" command. Here are some sample outputs of the "du" command on my CentOS 8 computer.

1. Display disk usage of my home directory using "du":

herong$ du ~
124876  ./ftp/files
124876  ./ftp
124880  ./work/pytorch
0  ./work/r
124884  ./work
4  ./.cache/pip/http/6/8/c/5/e
4  ./.cache/pip/http/6/8/c/5
4  ./.cache/pip/http/6/8/c
...
104  ./.cache/pip/http/c
592  ./.cache/pip/http
596  ./.cache/pip
0  ./.cache/matplotlib/tex.cache
28  ./.cache/matplotlib
624  ./.cache
0  ./.config/matplotlib
0  ./.config
4  ./.keras
250420  .

2. Display disk usage without any sub-directory entries using "du -d 0":

herong$ du -d 0
250420  .

3. Display disk usage in human readable units using "du -h":

herong$ du -d 0 -h
245M  .

4. Display disk usage in units of KB, MB, or GB using "du -k|m|g":

herong$ du -d 0 -k
250420  .

Table of Contents

 About This Book

 Introduction to Linux Systems

 Cockpit - Web Portal for Administrator

 Process Management

 Files and Directories

 Users and Groups

File Systems

 "df" - Display Free Space of File System

 Mount USB Drive as File System

 "dd" - Copy Data from/to Storage Devices

 Use "dd" Command to Test I/O Speed

"du" - Display Disk Usage of Directories

 Mount Windows NTFS File System

 Access Persmissions on "ntfs-3g" File System

 Mount Windows Shared Folders

 W95 Ext'd (LBA) Partition

 Reformat NTFS Partition into EXT4 Partition

 NFS (Network File System)

 Mount NFS (Network File System) on macOS

 /etc/mtab and /etc/fstab Files

 Unreachable Remote File Systems

 Block Devices and Partitions

 LVM (Logical Volume Manager)

 Installing CentOS

 SELinux - Security-Enhanced Linux

 Network Connection on CentOS

 Internet Networking Tools

 SSH Protocol and ssh/scp Commands

 Software Package Manager on CentOS - DNF and YUM

 vsftpd - Very Secure FTP Daemon

 LDAP (Lightweight Directory Access Protocol)

 Administrative Tasks

 References

 Full Version in PDF/EPUB