Help answer threads with 0 replies.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 12-11-2007, 05:38 AM   #1
Registered: May 2006
Location: Bangalore, INDIA
Distribution: Fedora Core
Posts: 69
Blog Entries: 2

Rep: Reputation: 17
varied output for linux df and du commands on same file system


When I run df -h /var , it displays the disk usage as

$ df -h /var/

Filesystem Size Used Avail Use% Mounted on
/dev/sda9 4.8G 3.3G 1.3G 73% /var

But when I run the du -sh for the same file system , the result
varies .

du -sh /var/
3.2G /var/

What is the reason for the difference in results .......

With Thanks in Advance
Old 12-11-2007, 10:41 PM   #2
LQ Veteran
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Mint
Posts: 17,809

Rep: Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743
"df" gives you the total space used on a partition

"du" gives you the space used by certain files/directories.

I assume that there is some overhead which would cause df to report higher numbers. You might want to try some experiments with--eg--the "-B" option to specify the block size. There may also be some rounding---eg the real numbers could be 3.249 (3.2) and 3.251 (3.3)


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
using commands to output path, filename and info to a txt file bob_man_uk Linux - General 3 05-11-2006 03:31 PM
when does linux switch from realmode file system to protectedmode file system sitthar Linux - General 3 04-08-2006 09:05 AM
Linux commands - giving doubled output shinobi59 Red Hat 1 11-07-2005 07:43 PM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 08:56 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration