Quick Answer: How to Check Directory Size in Linux?
Contents

How do I find the size of a specific directory in Linux?

If you want to check the total disk space used by a particular directory, use the -s flag.

To display the grand total of directories, add -c flag with du -sh command.

To display only the grand total of the given directory including all the sub-directories, use ‘grep’ command with ‘du’ command like below.

How do I find the largest files in a UNIX directory?

Linux find largest file in directory recursively using find

  • Open the terminal application.
  • Login as root user using the sudo -i command.
  • Type du -a /dir/ | sort -n -r. | head -n 20.
  • du will estimate file space usage.
  • sort will sort out the output of du command.
  • head will only show top 20 largest file in /dir/
David Miller

David Miller

Executive Financial & Market Analyst

David Miller brings 15 years of experience in global economics, personal finance strategy, and market dynamics. He specializes in turning complex economic trends into actionable insights for everyday readers.

Share this article
Twitter Facebook Pinterest