Skip to content

Instantly share code, notes, and snippets.

@tcpdump-examples
Last active December 19, 2022 11:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tcpdump-examples/4e091be962c2c40787e0f3ae678349df to your computer and use it in GitHub Desktop.
Save tcpdump-examples/4e091be962c2c40787e0f3ae678349df to your computer and use it in GitHub Desktop.

To check the size of a directory in Ubuntu, you can use the du command. This command stands for "disk usage" and it shows the amount of disk space used by the specified files or directories.

Options:

-h , --human-readable

-s, --summarize

-a, --all

-c, --total

--max-depth

To use the du command, open a terminal window and navigate to the directory whose size you want to check. Then, type du followed by the name of the directory, like this:

du /path/to/directory

This will display the size of the directory in kilobytes. If you want to see the size of all the files and directories inside the specified directory, you can use the -a option like this:

du -a /path/to/directory

This will display the size of each file and directory inside the specified directory, along with the total size at the end.

You can also use the -h option to display the size in a more readable format, such as megabytes or gigabytes, like this:

du -ah /path/to/directory

This will display the size of each file and directory in the specified directory in a human-readable format.

If you only want to get the total size of the directory, you can use -s option like this:

du -sh /path/to/directory

Overall, the du command is a useful tool for checking the size of directories in Ubuntu.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment