If you want to determine the size of a directory, the du command can be utilized. The acronym "du" stands for "disk usage," and it provides information about the disk space occupied by specified files or directories.
Here are some options you can use with the du command:
-h or --human-readable option presents the output in a more understandable format.
-s or --summarize option provides a summary of the total disk usage.
-a or --all option includes individual files and directories in the output.
-c or --total option shows the grand total of disk usage.
--max-depth option limits the depth of directory traversal.
To utilize the du command, follow these steps:
Open a terminal window.
Navigate to the directory you want to examine by typing the desired path.
Enter the command du followed by the directory name.
For example:
du /path/to/directory
This command will display the size of the directory in kilobytes. If you desire to see the size of all the files and directories within the specified directory, you can add the -a option:
du -a /path/to/directory
This will provide the size of each file and directory inside the specified directory, concluding with the total size.
Additionally, you can use the -h option to display the sizes in a more readable format, such as megabytes or gigabytes:
du -ah /path/to/directory
This will present the size of each file and directory in a human-readable format within the specified directory.
In summary, the du command is a valuable tool for assessing the sizes of directories in Ubuntu.
0 Comments