Results 1 to 4 of 4

Thread: Explain the difference

  1. #1
    Contributing Member
    Join Date
    Jul 2006
    Answers
    56

    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.


  2. #2
    Expert Member
    Join Date
    May 2006
    Answers
    114

    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.


  3. #3
    Expert Member
    Join Date
    Mar 2012
    Answers
    208

    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% /


  4. #4
    Junior Member
    Join Date
    May 2012
    Answers
    2

    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
  •  
About us
Applying for a job can be a stressful and frustrating experience, especially for someone who has never done it before. Considering that you are competing for the position with a at least a dozen other applicants, it is imperative that you thoroughly prepare for the job interview, in order to stand a good chance of getting hired. That's where GeekInterview can help.
Interact