Go2Linux | Linux Operating System

A site dedicated to: Linux Operating System

du - Linux command line for displaying the disk usage information

Date: 2007-05-01 00:00:00 -0400

When you ever need to know how much space a file or directory is using on your disk, you should use du, this command line command, is great for the job

Usage

du [options] [file or dir]

If you use it with no arguments you will the usage of all files and directories (recursively) of the working directory.

Options

-a
write counts for all files, not just directories
-B zs
Use size-byte blocks, so it means you will have the size in the number of block at the size you specified on the sz, example: -B M (will get the output in blocks of megabytes)
-c
Displays the grand total at the end
-h
Shows the in human readable format, so with K, M, G suffix near the size
-L
Displays the size of the symbolic linked directories instead of the symbolic link itself
-P
Opposite to -L, this time it shows the size of the symbolic link and the size of the file linked, this is the default
-s
Sumarize, so it displays the total of each subdirectory and not for its contents

Really a useful tool when you are running out of disk space, and need to know which directory or files are using that space.

If you liked this article please share it.

powered by TinyLetter

If you want to contact me in any other way, please use the contact page.