An ad-free and cookie-free website.
Learn to find file or directory disk space at the Linux command line.
Videos can also be accessed from the Linux Essentials Playlist on YouTube.
Linux du Command Summary with Examples (3:31)
Our fifty-second word, or command to memorize is
du from our category
du allows you to show disk utilization
for files and directories.
|Print help screen
|Print size in units of 1024 (one kilobyte)
Recall from the last video with
had a way to measure file system usage metrics, but it fell short of
helping with files and directories, so that's what we'll do here with
Before we start, it helps to think of commands as mini programs and
most follow this structure:
command -option(s) argument(s).
du command has
29 options and the argument is the file or directory
Like most commands, help is available with double-dash
-h reports in human-readable form,
like 1k for 1 kilobyte, M for
megabyte, G for gigabyte.
So why is
du an important command?
df was good for the big
du now offers a more granular
view, because we often need to recycle data space.
And now you know how to do that.
Okay, the best way to embed this in your memory is by typing in your own terminal window.
Find this on your Mac using a program called Terminal. On Linux use Terminal or Konsole, and currently Microsoft is adding this functionality to Windows.
Here we go. Let's view our directory of files with
And make note of file sizes. Then do a
This defaults to the directory view, but this isn't very interpretable, like what does 4 and 208 mean? Right?
Next, let's see the file view using the
Helpful, but not ideal.
Then, let's make it friendlier by adding
-h option to the end.
Directory 4, total is 208 still, but that does look a lot better.
And last, let's go back to the
Notice how file sizes don't match? Well, if you read the short
du by using a
It does say estimate, and it looks like it's rounding up.
Okay now you know how to use
And you know the syntax for commands, options and arguments.
One last tip about the
du does estimate data and
does round, that's often good enough to see who's using up precious
Okay, thanks for visiting today. I hope this was a helpful
introduction to the
For an overview of the 100 videos, the 8 quizzes, a cheat sheet, the categories and a Q&A section, visit:
Connect now on YouTube and @factorpad on Twitter, so you don't have to remember to later.
free command, click Next.
A newly-updated free resource. Connect and refer a friend today.