Languages
[Edit]
EN

Bash - print files and directories sizes for current working directory

8 points
Created by:
marc_so
264

In this short article, we would like to show how to print sizes for files and directories located in the current working directory using Bash.

Quick solution (run the following command):

du -hs *

Where:

  • -h causes printing in human-readable format (KB, MB, GB, etc.),
  • -s causes printing total size summary for each element in the directory,
  • * causes checking size for each not hidden item in the current working directory.

Example output:

3.3G    pictures
9.0G    backups
135M    projects

 

Native Advertising
🚀
Get your tech brand or product in front of software developers.
For more information Contact us
Dirask - we help you to
solve coding problems.
Ask question.

❤️💻 🙂

Join