LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
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!

Notices

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

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


Greetings,

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
zaman
 
Old 12-11-2007, 09:41 PM   #2
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Arch/XFCE
Posts: 17,802

Rep: Reputation: 728Reputation: 728Reputation: 728Reputation: 728Reputation: 728Reputation: 728Reputation: 728
"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)
 
  


Reply


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 02:31 PM
when does linux switch from realmode file system to protectedmode file system sitthar Linux - General 3 04-08-2006 08:05 AM
Linux commands - giving doubled output shinobi59 Red Hat 1 11-07-2005 06:43 PM


All times are GMT -5. The time now is 10:29 PM.

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