du

>Usage

The du (disk usage) command is a utility used to estimate and display the amount of disk space used by files or directories. It helps users understand the size of directories and files in the file system, making it useful for identifying disk usage patterns and managing storage space.

>Synopsis

du [option] [file/directory]

>Options

-h

Displays sizes in a human-readable format (e.g., KB, MB, GB).

Example 1:

Dots

-zsh

>du -h


60K ./file_permission_ownership
56K ./file_content_viewing_editing
144K ./networking
12K ./other
44K ./file_directory_management
320K ./system_monitoring_managment
92K ./package_management
88K ./text_processing
76K ./compressing_archiving
76K ./environment_management
0B ./user_group_management
992K .

-s

Summarizes the total disk usage of the specified file or directory instead of listing each subdirectory.

Example 2:

Dots

-zsh

>du -h -s


992K .

-c

Displays a grand total of all disk usage at the end of the output.

Example 3:

Dots

-zsh

>du -h -c


60K ./file_permission_ownership
56K ./file_content_viewing_editing
144K ./networking
12K ./other
44K ./file_directory_management
320K ./system_monitoring_managment
92K ./package_management
88K ./text_processing
76K ./compressing_archiving
76K ./environment_management
0B ./user_group_management
988K .
988K total

-d

-d [Num] specifies the depth of directories to include in the output. For example, -d 1 lists the size of the specified directory and its immediate subdirectories.

Example 4:

Dots

-zsh

>du -h -d 0


988K .

-a

Includes all files in the output, not just directories.

Example 5:

Dots

-zsh

>uname -h -a


12K ./.DS_Store
12K ./file_permission_ownership/fpo_chattr.html
24K ./file_permission_ownership/fp_chmod.html
12K ./file_permission_ownership/fpo_setfac1.html
12K ./file_permission_ownership/fpo_getfac1.html
0B ./file_permission_ownership/fpo_chmod.html
60K ./file_permission_ownership
20K ./file_content_viewing_editing/fcve_cat.html
12K ./file_content_viewing_editing/fcve_wc.html
12K ./file_content_viewing_editing/fcve_diff.html
12K ./file_content_viewing_editing/fcve_comm.html
56K ./file_content_viewing_editing
16K ./networking/n_traceroute.html, ...

>Quiz

Progress: Question ? out of ?

Question Title

Page written by Davide Soardi