-
Contributing Member
Explain the difference
Is there any difference between the commands df and du in UNIX operating system. If so what is it? A example on each of the above commands would help me understand this in detail.
-
Expert Member
Re: Explain the difference
du: This command prints the disk usage (in Kb) of each directory and it's sub
directories. By default it starts from the current directory, but supplying
the name of a directory after the command will make it start from that
directory.
df: This command tells you the amount of free space on all mounted file systems,
or you can specify the name of a device you want to check.
-
Expert Member
Re: Explain the difference
1.The du command display disk usage statistics and the df command is to display free disk space.
2.'df' returns the space amounts based on filesystem allocation data. 'du' traverses the filesystem and adds the space used by the files it finds.
Example :$ du -h /tmp
The -h option provides "Human-readable" outpu i.e. you will see it in Byte, Kilobyte, Megabyte, Gigabyte, Terabyte and Petabyte.
Example:$ df -h
outpuy can be
Filesystem Size Used Avail Capacity Mounted on
/dev/wd0a 938M 43.0M 848M 5% /
-
Junior Member
Re: Explain the difference
They work in a very different manner.
du is disk space used.
df is disk space free.
du does its work by examining the files or directories you name.
df looks at the files or directories you name and determines what file system contains them,
Then it examines the global data of the file system itself.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules