The du command in Linux is used to estimate and report the disk space usage of files and directories. It provides information about how much disk space is being used by specified files or directories.
Basic Usage:
- To check the disk usage of a directory:
du /path/to/directory
Common Options:
-h: Makes the output human-readable (e.g., shows sizes in KB, MB).-s: Displays only a total for each argument.-c: Produces a grand total.-a: Shows disk usage for files as well as directories.--max-depth=N: Limits the depth of directory traversal.
Example:
To see the disk usage of a directory and its contents:
du -h ~/project/data
This command will display the sizes in a more understandable format.
