Shell learns 46 days----file system spatial information df and DU commands

Source: Internet
Author: User
Tags disk usage

Spatial information for file systems

DF Command

Dfcommand provides a single-line summary,a row shows the used and available space for a loaded system of asking the price.the unit depends on the system,some use blocks,some of them areKB.Most modern implementations support- kOptions,That is, forced useKBUnit,as well-L (Lowercase LettersL)Options,Show local file system only,Exclude network-loaded file systems.

DF Command Detailed

Syntax :

DF [ Options ] [ file or directory ]

Use :

Displays inode or Space usage within one or more file systems

Main options :

-I.

Display inode technology , rather than space

-K

When space is displayed , in kilobytes , not blocks

-L

lowercase L, Show only local file system

Behavior :

DF is for each file or directory parameter , and if no parameters are supplied , all file systems , producing a single-line header to identify the output flange , The usage Report of the file system that contains the file or directory is then connected .

Case

$df

Filesystem 1k-blocks used Available use% mounted on

/dev/sda3 1032088 262592 717068 27%/

Tmpfs 961216 0 961216 0%/dev/shm

/DEV/SDA1 198337 34004 154093 19%/boot

/dev/sda7 14219628 166640 13330660 2%/Home

/dev/sda2 3120456 1874636 1087308 64%/usr

/dev/sda5 1032088 177716 801944 19%/var

/DEV/SDB1 2071384 68632 1897528 4%/disk1

Analysis:d FThe first column of the output list of the command is the path name of the device that represents the file system(is typically a partition on a hard disk);The second column gives the block of data that the partition contains(1024x768bytes)the number;The 34th column indicates the number of data blocks used and available respectively.users will also find it strange that;the sum of the 34th column is not equal to the data block in the second column.this is because each of the default partitions leaves a small amount of space for the system administrator to use.meet the full situation of normal user space in time,the administrator can still log in and leave the workspace needed to solve the problem.Checklistuse%Medium column indicates the percentage of normal user space usage,In time this figure reached100%,partitions can still be left with the space that the system administrator uses;finallyMount oncolumn represents the mount point of the file system.

$DF-I.

Filesystem inodes iused IFree iuse% mounted on

/dev/sda3 65536 6410 59126 10%/

TMPFS 240304 1 240303 1%/DEV/SHM

/DEV/SDA1 51200 51161 1%/boot

/DEV/SDA7 903984 903898 1%/Home

/dev/sda2 198400 57886 140514 30%/usr

/dev/sda5 65536 2356 63180 4%/var

/DEV/SDB1 131648 131637 1%/disk1

Analysis : displaying disk usage in inode mode

$DF/Home

Filesystem 1k-blocks used Available use% mounted on

/dev/sda7 14219628 166640 13330660 2%/Home

Analysis : Displays the specified type of disk

Du command

The du command also looks at the space used , but Unlike the DF command , the du command is a view of the space used by the file and directory disks , or is it with DF the command has some difference .

Description of the du command

Syntax :

Du [ options ] [ file ]

Purpose : Displays the spatial utilization of one or more directory trees

Main options :

-K

The display of the space, in kilobytes , rather than ( system dependent ) blocks (block)

-S

For each parameter , only a single line summary is displayed

Behavior :

Du will ---- for each file or directory parameter , if none is provided, then the current directory , producing an output line , It will contain the usage as an integer , followed by the name of the file or directory . unless a given - S Options , otherwise, each directory parameter is recursively searched for , produce a report row for each nested directory .

Case :

$du # using the du command in the tmp directory

4./. Ice-unix

8.

Analysis : Displays only the directory size of subdirectories below the current directory and the total size of the big money directory , with the bottom 8 being the total size of the current directory . Note , displays only the contents of the .

Case : Displays the size of the space occupied by the specified file

$du/etc/passwd

4/etc/passwd

Case : View the space occupied by the specified directory

$du/root

8/root/.w3m

4/root/.pki/nssdb

8/root/.pki

200/root

Case : Show the size of multiple files

$du/tmp/root

4/tmp/ert

4/tmp/. Ice-unix

12/tmp

8/root/.w3m

4/root/.pki/nssdb

8/root/.pki

200/root

Case : Show only the size of the sum

$du-S/root

200/root

Case study : Easy-to-read format

$du-hs/root

200k/root

Case : files and directories are displayed

Du-ah/root

Case : shows how many files or directories each occupy the size of disk space . and counting their sums.

$du-cs/etc/tmp/root

28048/etc

12/tmp

200/root

28260 Total Dosage

Case : Sort by space size

$du/etc| Sort-nr | More

the difference between du and DF

the DF command is used to view the usage of the file system ;

Use the DF command to output the first callout of the message :

File system 1k- block used available % mount point

the du command is used to view the usage of disk space for a file or directory .

Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

Shell learns 46 days----file system spatial information df and DU commands

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.