music
OSdata.com: programming text book 

OSdata.com

df

summary

    This subchapter looks at df, a UNIX (and Linux) command.

    df is used to display information on disk usage.

free book on UNIX/Linux System Administration

Teach Yourself UNIX/Linux System Administration and Shell Programming

free computer programming text book project

table of contents
If you like the idea of this project,
then please donate some money.
more information on donating

Google

df

    This subchapter looks at df, a UNIX (and Linux) command.

    df is used to display informaiton on disk usage.

human readable

    Use the -h or -H option to see space used in human readable format (such as kilobytes, megabytes, gigabytes, terabytes, petabytes, etc.). Both options do the same thing.

    $ df -h
    Filesystem      Size   Used  Avail Capacity  Mounted on
    /dev/disk0s10  149Gi  117Gi   32Gi    79%    /
    devfs          111Ki  111Ki    0Bi   100%    /dev
    fdesc          1.0Ki  1.0Ki    0Bi   100%    /dev
    map -hosts       0Bi    0Bi    0Bi   100%    /net
    map auto_home    0Bi    0Bi    0Bi   100%    /home
    /dev/disk1s2   498Gi   40Gi  457Gi     9%    /Volumes/msdos
    /dev/disk1s1   434Gi   81Gi  353Gi    19%    /Volumes/Mac FreeAgent GoFlex Drive
    $

    The exact format of the human readable output will vary from system to system, but the columns are usually labelled (as in the Mac OS X example above). The file system path is a reference to a hard drive, storage device, network, or other location. The mount point is the location in the directory tree where you can find the file system.

    Also note that adding the used and available space will not necessarily be an exact match with the total. One explanation is that a journaling system will account for up to 5% of the disk space.

type

    Use the -T option to see the type of file system.

    $ df -T

    You can also provide specified filesystem types after the -T option to only show filesystems of the designated type. Use a comma separated list to provide multiple filesystem types. Pre-fix with no to show file systems other than the listed types.

    As an example, the following command will display all file systems other than those of type NFS and MFS:

    $ df -T nonfs,mfs

    Use the lsvfs command to find out what types of filesystems are available on your computer or server.

differences between du and df

    You may notice that du and df sometimes give very different numbers for the disk space on a production server. This rarely happens on a desktop or workstation. Usually df will output the bigger disk usage. This occurs when an inode is deallocated.

    Some process has created a large temporary file and some other process has deleted it. The file remains in existence until the first process closes it, but the file system immediately removes access for any other process (to prevent all kinds of strange errors by accessing or manipulating non-existent files.

    Running lsof | grep tmp or lsof | grep deleted will often reveal a large temporary file that accounts for the difference.

    du and df should resolve back to the same results after the first process releases the file. If the problem persists, use fsck to fix it.

blocksize

    Use the -b or -P option to see use the default of blocks. This may be needed to override a BLOCKSIZE specification from the environment. In the early days of UNIX and Linux, the default block size was normally 512-bytes. In more modern times the size of a block can be 1K, 8K, 32K, or even bigger.

    $ df -b

    result in 512 byte blocks

    Use the -k option to see use 1023-byte blocks. This is 1-Kbyte blocks.

    $ df -k

    result in Kilo-byte blocks

    Use the -m option to see use 1048576-byte blocks. This is 1-Mbyte blocks.

    $ df -m

    result in Mega-byte blocks

    Use the -g option to see use 1073741824-byte blocks. This is 1-Gbyte blocks.

    $ df -g

    result in Giga-byte blocks

display inodes

    Use the -i option to include statistics on the number of free inodes.

    $ df -i

    On Mac OS X, the additional columns are iused, ifree, and %iused.

local

    Use the -l option to only display information about locally-mounted filesystems (no network fielsystems).

    $ df -l

long delay filesystems

    Use the -n option to display previously obtained statistics. This is used when one or more filesystems are in a state where there will be a long delay to provide statistics.

    $ df -n

other

    On November 8, 2010, Ramesh Natarajan named this the number 25 most frequently used UNIX/Linux command at this web page 50 Most Frequently Used UNIX / Linux Commands (With Examples).

    In June 2009, Ken Milberg named this command as one of the Top 50 universal UNIX commands at this web page Top 50 Universal INIX commands. Note that this web page requires agreeing to be spammed before you can read it.


comments, suggestions, corrections, criticisms

please contact us

your name:
email address:
phone number:
message:

free music player coding example

    Coding example: I am making heavily documented and explained open source code for a method to play music for free — almost any song, no subscription fees, no download costs, no advertisements, all completely legal. This is done by building a front-end to YouTube (which checks the copyright permissions for you).

    View music player in action: www.musicinpublic.com/.

    Create your own copy from the original source code/ (presented for learning programming).


return to table of contents
free downloadable college text book
free downloadable system administrator and shell programming book

view text book
HTML file

Because I no longer have the computer and software to make PDFs, the book is available as an HTML file, which you can convert into a PDF.

previous page next page
previous page next page

free book on UNIX/Linux System Administration

Teach Yourself UNIX/Linux System Administration and Shell Programming

free computer programming text book project

Building a free downloadable text book on computer programming for university, college, community college, and high school classes in computer programming.

If you like the idea of this project,
then please donate some money.

send donations to:
Milo
PO Box 1361
Tustin, California 92781

Supporting the entire project:

    If you have a business or organization that can support the entire cost of this project, please contact Pr Ntr Kmt (my church)

more information on donating

Some or all of the material on this web page appears in the
free downloadable college text book on computer programming.


Google


Made with Macintosh

    This web site handcrafted on Macintosh computers using Tom Bender’s Tex-Edit Plus and served using FreeBSD .

Viewable With Any Browser


    †UNIX used as a generic term unless specifically used as a trademark (such as in the phrase “UNIX certified”). UNIX is a registered trademark in the United States and other countries, licensed exclusively through X/Open Company Ltd.

    Names and logos of various OSs are trademarks of their respective owners.

    Copyright © 2012, 2013 Milo

    Created: February 4, 2012

    Last Updated: August 21, 2013


return to table of contents
free downloadable college text book
free downloadable system administrator and shell programming book

previous page next page
previous page next page