clarkmaio
clarkmaio

Reputation: 399

Discrepancy using du -hs * command in Unix in subfolders

Ciao, I have the following problem.

When I use the command du -hs foldername I can see that the folder I am analysing has a size of 80Gb.

enter image description here

But if use cd foldername and rerun the script (or the code ls -lah to see the details of each file) I can not find files that justify that size.

enter image description here

Can you explain me why?

How can I find the files/folder that more than anyone contribute to the 80Gb?

Thank you for your help

Upvotes: 1

Views: 784

Answers (1)

hobbs
hobbs

Reputation: 239672

Probably because * doesn't include files/directories with names that start with a dot.

Instead of using du -sh *, use du -ah -d 1. It will start at the current directory, instead of taking a list of files/directories from the commandline. -a tells it to include files as well as directories, and -d 1 tells it to list down to a "maximum depth" of 1, i.e. show files in the current directory, and show the totals for subdirectories of the current directory, but don't show a detailed list of everything in those subdirectories.

Upvotes: 2

Related Questions