20. df and du command - muneeb-mbytes/linux_course GitHub Wiki

df and du command

df and du commands every system administrator runs frequently. while df command display how much disk space your file system is using and amount of available disk space for file system, du display files and directories disk usage on file system.

df and du and it's variations

The below figure represents the df and du command variations.

df-du

                                   Figure.1.Representation of df and du command variation

df and du command cheat sheet

Sr No. df and du command with different options description
1 df display how much disk space your file system is using and amount of available disk space for file system
2 df -h display size in its human readable (K, M, G) format
3 du display files and directories disk usage on file system
4 du -h display size in its human readable (K, M, G) format
5 df --help Give more information about df command
6 du --help Give more information about du command
                                        Tabular column.1. df and du command cheat sheet

df

The df (disk free) command, is used to display the information related to file systems about total space and available space.Disk space is shown in 1K blocks by default.

Syntax :

df [OPTION]... [FILE]...

The below figure shows output of df command, which indicates filesystem, size in 1k blocks, used space, available space, use in percentage and disk use on a mounted filesystem in red box.

df

                                          Figure.1. df output

The below GIF shows the whole process from sourcing scripting file till the output.

df

                                          GIF.1. df output GIF

Link to GitHub lab: https://github.com/muneeb-mbytes/linux_course/blob/b7_team_kachori/df_and_du_command/df.csh


df -h

Use -h option to display size in its human readable (K, M, G) format.

The below figure shows output of df -h command, which indicates filesystem, size in human readable format, used space, available space, use in percentage and disk use on a mounted filesystem in red box.

df-h

                                    Figure.2. df -h output

The below GIF shows the whole process from sourcing scripting file till the output.

df-h

                                 GIF.2. df -h output GIF

Link to GitHub lab: https://github.com/muneeb-mbytes/linux_course/blob/b7_team_kachori/df_and_du_command/df-h.csh


du

The du (disk usage) command, is used to display information related to file system about estimate file space used under a particular directory or files.

Syntax :

du [OPTION]... [FILE]...

The below figure shows output of du command, which indicates size and list of the contents current directory.

du

                                    Figure.3. du output

The below GIF shows the whole process from sourcing scripting file till the output.

du

                                    GIF.3. du output GIF

Link to GitHub lab: https://github.com/muneeb-mbytes/linux_course/blob/b7_team_kachori/df_and_du_command/du.csh


du -h

Use -h option to display size in its human readable (K, M, G) format.

The below figure shows output of du command, which indicates size in human readable format and list of the contents current directory.

du-h

                                   Figure.4. du -h output

The below GIF shows the whole process from sourcing scripting file till the output.

du-h

                                    GIF.4. du -h output GIF

Link to GitHub lab: https://github.com/muneeb-mbytes/linux_course/blob/b7_team_kachori/df_and_du_command/du-h.csh


df --help

To list all df command options, type df --help. The system lists all available options.


du --help

To list all du command options, type du --help. The system lists all available options.


To learn symbolic links: https://github.com/muneeb-mbytes/linux_course/wiki/21.-symbolic-_links