Linux Du Command Illustrations
The du Linux command is pretty popular for UNIX and Linux devices. This command is applied to perspective the information and facts about disk usage of all directory tree and files on a machine. This command has various parameter flags or possibilities that aids to see the info of disk use in a lot of diverse formats. Making use of the du command, you can also exhibit the information and directory size aspects in a recurring way.
We will give a transient demo in this article on the distinct utilizes of Linux du command with examples.
Show Summary of Disk Use
Making use of the ‘du’ command, the full disk utilization summary which include all sub-directories can be exhibited by managing the next command:
The following output displays the data about the total number of disk blocks along with all sub-directories of the ‘/home/kbuzdar’ directory.
Use of Du Command with Several Flags
Beneath are the adhering to solutions that you can use with the du command:
Use of -h flag with Du Command:
When the du command is applied with the ‘-h’ flag, it reveals the disk usage summary in a human-readable structure. The block sizing info is shown in bytes, kilobytes (K), megabytes (M), and so on.
Use of -s flag with Du Command:
Use option ‘-sh’ with du command to screen the total disk utilization dimension of a listing as follows:
Use of -a flag with Du Command
To screen the disk utilization facts of directories and all information, use the solution ‘-a’ with the du command.
To check out the disk utilization facts of all directories and information in a human-readable structure, use the possibility ‘-a’ along with the ‘-h’ flag as follows:
Display Disk Details in Kilobytes / Megabytes
To show the disk use data of a directory tree bundled with all sub-tree directories in kilobytes (1024 bytes), use the alternative ‘-k’ with du command as follows:
Likewise, use alternative ‘-mh’ for megabytes and human-readable structure to display the disk utilization of all listing tree.
Exhibit the Disk Utilization Total Measurement
Use the ‘-ch’ flag with the du command to get the overall disk usage place information at the past line.
Exclude Unique File Structure
The pursuing command shows the disk usage data of all directories and data files apart from those people documents that match the provided lookup sample. For instance, we want to exclude all text documents while exhibiting the overall listing measurement. So, it will exclude all .txt file formats by way of the –exclude flag.
# du -ah –exclude=“*.txt” /home/kbuzdar
The subsequent output will be revealed on the terminal:
Display screen Disk Utilization Depth with Timestamp
To display screen the disk use information alongside with the timestamp, use the –time flag alongside with the du command as follows:
# du -ha –time /home/kbuzdar
We have stated the unique works by using of du command with illustrations in this article. The Linux du command assists consumers to get specifics of disk use in a human-readable format so that the person can conveniently understand the system’s disk use summary.