#!/linuxSucks/Get the size of a specific directory in Linux

May 31, 2021

To get the actual size of a directory you need to run the du command (disk usage)

Examples

For a directory owner by user

du -sh Downloads

The output will be like

24G Downloads/
  1. s - Display only the total size of the specified directory, do not display file size totals for subdirectories.
  2. h - Print sizes in a human-readable format (h).

If the directory is owner by root

sudo du -sh /var

The output will be like

85G /var

For more option check man du

Home  Linux  Notes  Blog Spot