RSS Subscription
Linux Howtos & Tutorials

Enter your email:

Delivered by


NOTE:New tutorials are from LinuxCareer.com

Poll

Do you own or wish to have iPhone?
 


Linux eBooks FREE Download
A guide to programming Linux kernel modules
Introduction to Linux - A Hands on Guide
A Newbie's Getting Started Guide to Linux

Linux from Scratch - Create Your Own Linux System - Free eBook

Linux: The Hacking Solution (v.3.0)

SQLite 3 with PHP Essential Training – Free Video Training Tutorials

This guide will introduce you to the world of GNU/Linux

The GNU/Linux Advanced Administration

A Complete Beginner's Manual for Ubuntu 10.04 (Lucid Lynx)

Advanced Bash-Scripting Guide

Set up, maintain, and secure a small office email server

Partner Linux Sites:
How-To.LinuxCareer.com
Jobs.LinuxCareer.com
TuxMachines
Monsterb
LinuxBloggers
AdamsInfo
LinuxScrew
All For Linux

du

Article Index
1. Name
2. Synopsis
3. Frequently used options
4. Examples

1. Name

du [man page] - estimate file space usage

2. Synopsis

du [OPTION]... [FILE]...
du [OPTION]... --files0-from=F

3. Frequently used options

-h, --human-readable print sizes in human readable 
format (e.g., 1K 234M 2G) 
-s, --summarize display only a total for 
each argument
--max-depth=N print the total for a directory 
(or file, with --all)
only if it is  N  or  fewer  levels
below  the  command   line   argument;
--max-depth=0 is the same as --summarize 

4. Examples

du is abbreviation of "disk usage". This command tool reports usage by given directory. Lets suppose that we have this directory structure in /tmp:

$ cd /tmp
$ mkdir -p dir1/dir2/dir3
$ tree dir1

du - create a example directories
By default du command traverse whole directory structure:

$ du dir1 

du command traverse whole directory structure
by option -s we instruct du command to print total just for given argument. In our case the argument is dir1.

$ du -s dir1 

instruct du command to print total
We can do the same by --max-depth=N:

$ du --max-depth=0 dir1 

du max-depth prefix Lets se how it works on /var directory:

# du -s /var 

du - print total for whole directory

# du --max-depth=1 /var 

du max-depth prefix 1
If its hard for you to read size in bytes you can instruct du to display size in human readable format:

# du -h --max-depth=1 /var 

du command in human readable format

Share this linux post:

Submit du in Delicious Submit du in Digg Submit du in FaceBook Submit du in Google Bookmarks Submit du in Stumbleupon Submit du in Technorati Submit du in Twitter
 
Comments for this page are closed !!!
Please visit our new Linux Forum for additional help or discussion.


Linux eBooks FREE Download