In this article, I will discuss the du and df commands. The du and df commands are important tools for Linux systems to display disk usage for Linux file systems. Here we will share the usage of these two commands with some examples.
Du command
Du (short for disk usage) is a command to find disk usage for files and directories. The du command provides results in multiple formats when used with various options.
Here are some examples:
1, get a disk usage overview of all subdirectories under a directory
$du /home
The output of this command will display all files and directories in /home and the display block size.
2. Display file/directory size in human readable format, ie kb, mb, etc.
$du -h /home
3, the total disk size of the directory
$du -s /home
It is the total size of the /home directory
Df command
Df (short for disk filesystem) is used to display the disk utilization of a Linux system. (LCTT translation: df may be short for disk free.)
Here are some examples.
1. Display device name, total number of blocks, total disk space, used disk space, available disk space, and mount points on the file system.
$df
2. Information in human readable format
$df -h
The above command displays information in a human readable format.
3, display information about a specific partition
$df -hT /etc
-hT plus the target directory will display information for /etc in a readable format.
Although the du and df commands have more options, these examples will give you a first look. If you can't find what you're looking for here, then you can refer to the man page for the command.
7.5 Mm Nano Tip,Smart Pen Infrared,Infrared Pen Touch,Slim Infrared Pen
Shenzhen Ruidian Technology CO., Ltd , https://www.wisonen.com