Get the total size of all the files in a directory

0 min read 75 words

It’s amazing how many times I’ve need to find out the total size of all the files in a directory on one of our servers.

I have grown to love the simplicity of the `du` command.

du -sh

du = Display disk Usage statistics

s tells us to display an entry for each specified file, while h is for “human-readable” output.

This will use the unit suffixes of Byte, Kilobyte, Megabyte, Gigabyte, Terabyte and Petabyte.

Tags:
Andrew
Andrew

Andrew is a visionary software engineer and DevOps expert with a proven track record of delivering cutting-edge solutions that drive innovation at Ataiva.com. As a leader on numerous high-profile projects, Andrew brings his exceptional technical expertise and collaborative leadership skills to the table, fostering a culture of agility and excellence within the team. With a passion for architecting scalable systems, automating workflows, and empowering teams, Andrew is a sought-after authority in the field of software development and DevOps.

Tags