国产宅男网站在线|亚洲A级性爱免费视频|亚洲中精品级在线|午夜福利AA毛

  • <dd id="gf5jf"><th id="gf5jf"></th></dd>

    <cite id="gf5jf"><label id="gf5jf"></label></cite>
  • <div id="gf5jf"><listing id="gf5jf"></listing></div>
    學(xué)習(xí)啦>學(xué)習(xí)電腦>操作系統(tǒng)>Linux教程>

    linux中df命令的詳細(xì)解釋

    時間: 佳洲1085 分享

      在linux系統(tǒng)下df命令的作用是現(xiàn)實磁盤空間的使用情況。下面由學(xué)習(xí)啦小編整理了linux中df命令的詳細(xì)解釋,希望對你有幫助。

      linux中df命令的詳細(xì)解釋

      df命令概述

      df命令作用是列出文件系統(tǒng)的整體磁盤空間使用情況??梢杂脕聿榭创疟P已被使用多少空間和還剩余多少空間。

      df命令顯示系統(tǒng)中包含每個文件名參數(shù)的磁盤使用情況,如果沒有文件名參數(shù),則顯示所有當(dāng)前已掛載文件系統(tǒng)的磁盤空間使用情況,參考示例1。

      在默認(rèn)情況下,磁盤空間是以1KB為單位進(jìn)行顯示的,但是,如果POSIXLY_CORRECT環(huán)境變量被設(shè)置為true,這種情況下默認(rèn)使用512字節(jié)為單位顯示,參考示例9。

      df命令語法

      df [選項] [文件名]

      參數(shù):

      -a:--all,顯示所有的文件系統(tǒng),包括虛擬文件系統(tǒng),參考示例2。

      -B:--block-size,指定單位大小。比如1k,1m等,參考示例3。

      -h:--human-readable,以人們易讀的GB、MB、KB等格式顯示,參考示例4。

      -H:--si,和-h參數(shù)一樣,但是不是以1024,而是1000,即1k=1000,而不是1k=1024。

      -i:--inodes,不用硬盤容量,而是以inode的數(shù)量來顯示,參考示例5。

      -k:以KB的容量顯示各文件系統(tǒng),相當(dāng)于--block-size=1k。

      -m:以KB的容量顯示各文件系統(tǒng),相當(dāng)于--block-size=1m。

      -l:--local,只顯示本地文件系統(tǒng)。

      --no-sync:在統(tǒng)計使用信息之前不調(diào)用sync命令(默認(rèn))。

      -sync:在統(tǒng)計使用信息之前調(diào)用sync命令。

      -P:--portability,使用POSIX格式顯示,參考示例6。

      -t:--type=TYPE,只顯示指定類型的文件系統(tǒng),參考示例7。

      -T:--print-type,顯示文件系統(tǒng)類型,參考示例8。

      -x:--exclude-type=TYPE,不顯示指定類型的文件系統(tǒng)。

      --help:顯示幫助信息。

      --version:顯示版本信息。

      linux中df命令詳解示例

      示例1:查看包含給定文件磁盤空間使用情況

      [root@localhost ~]# df /home #指定一個文件夾,查看該文件夾所在磁盤的使用情況

      Filesystem 1K-blocks Used Available Use% Mounted on

      /dev/sda2 16036224 2749160 12459316 19% /

      [root@localhost ~]# df /bin/ls #指定一個文件

      Filesystem 1K-blocks Used Available Use% Mounted on

      /dev/sda2 16036224 2749160 12459316 19% /

      [root@localhost ~]# df /bin/ls /home #指定多個文件或文件夾

      Filesystem 1K-blocks Used Available Use% Mounted on

      /dev/sda2 16036224 2749160 12459316 19% /

      /dev/sda2 16036224 2749160 12459316 19% /

      [root@localhost ~]# df /bin/ls /home /usr/ #指定多個文件或文件夾

      Filesystem 1K-blocks Used Available Use% Mounted on

      /dev/sda2 16036224 2749160 12459316 19% /

      /dev/sda2 16036224 2749160 12459316 19% /

      /dev/sda2 16036224 2749160 12459316 19% /

      [root@localhost ~]# df # 默認(rèn)情況

      Filesystem 1K-blocks Used Available Use% Mounted on

      /dev/sda2 16036224 2750464 12458012 19% /

      /dev/sda1 295561 16911 263390 7% /boot

      tmpfs 1028272 0 1028272 0% /dev/shm123456789101112131415161718192021222324123456789101112131415161718192021222324

      輸出結(jié)果列說明:

      Filesystem:代表該文件系統(tǒng)時哪個分區(qū),所以列出的是設(shè)備名稱。

      1K-blocks:說明下面的數(shù)字單位是1KB,可利用-h或-m來改變單位大小,也可以用-B來設(shè)置。

      Used:已經(jīng)使用的空間大小。

      Available:剩余的空間大小。

      Use%:磁盤使用率。如果使用率在90%以上時,就需要注意了,避免磁盤容量不足出現(xiàn)系統(tǒng)問題,尤其是對于文件內(nèi)容增加較快的情況(如/home、/var/spool/mail等)。

      Mounted on:磁盤掛載的目錄,即該磁盤掛載到了哪個目錄下面。

      示例2:查看所有文件系統(tǒng)

      [root@localhost ~]# df -a #包括虛擬文件系統(tǒng)

      Filesystem 1K-blocks Used Available Use% Mounted on

      /dev/sda2 16036224 2749160 12459316 19% /

      proc 0 0 0 - /proc

      sysfs 0 0 0 - /sys

      devpts 0 0 0 - /dev/pts

      /dev/sda1 295561 16911 263390 7% /boot

      tmpfs 1028272 0 1028272 0% /dev/shm

      none 0 0 0 - /proc/sys/fs/binfmt_misc

      none 0 0 0 - /proc/fs/vmblock/mountPoint

      sunrpc 0 0 0 - /var/lib/nfs/rpc_pipefs

      [root@localhost ~]# df # 默認(rèn)

      Filesystem 1K-blocks Used Available Use% Mounted on

      /dev/sda2 16036224 2749160 12459316 19% /

      /dev/sda1 295561 16911 263390 7% /boot

      tmpfs 1028272 0 1028272 0% /dev/shm12345678910111213141516171234567891011121314151617

      說明:系統(tǒng)里面存在很多特殊的文件系統(tǒng),這些比較特殊的文件系統(tǒng)幾乎都是在內(nèi)存當(dāng)中,(如/proc掛載點),所以,這些特殊文件系統(tǒng)都不會占據(jù)硬盤空間。

      示例3:指定單位大小

      [root@localhost ~]# df -B 1k #1k為單位

      Filesystem 1K-blocks Used Available Use% Mounted on

      /dev/sda2 16036224 2749160 12459316 19% /

      /dev/sda1 295561 16911 263390 7% /boot

      tmpfs 1028272 0 1028272 0% /dev/shm

      [root@localhost ~]# df --block-size 1m #1M為單位

      Filesystem 1M-blocks Used Available Use% Mounted on

      /dev/sda2 15661 2685 12168 19% /

      /dev/sda1 289 17 258 7% /boot

      tmpfs 1005 0 1005 0% /dev/shm12345678910111234567891011

      示例4:以人們易讀的方式顯示

      [root@localhost ~]# df -h

      Filesystem Size Used Avail Use% Mounted on

      /dev/sda2 16G 2.7G 12G 19% /

      /dev/sda1 289M 17M 258M 7% /boot

      tmpfs 1005M 0 1005M 0% /dev/shm1234512345

      示例5:以inode的數(shù)量顯示

      [root@localhost ~]# df -i

      Filesystem Inodes IUsed IFree IUse% Mounted on

      /dev/sda2 4141216 101279 4039937 3% /

      /dev/sda1 76304 35 76269 1% /boot

      tmpfs 257068 1 257067 1% /dev/shm1234512345

      示例6:使用POSIX格式顯示

      [root@localhost ~]# df -P #使用POSIX格式顯示

      Filesystem 1024-blocks Used Available Capacity Mounted on

      /dev/sda2 16036224 2750464 12458012 19% /

      /dev/sda1 295561 16911 263390 7% /boot

      tmpfs 1028272 0 1028272 0% /dev/shm

      [root@localhost ~]# df

      Filesystem 1K-blocks Used Available Use% Mounted on

      /dev/sda2 16036224 2750464 12458012 19% /

      /dev/sda1 295561 16911 263390 7% /boot

      tmpfs 1028272 0 1028272 0% /dev/shm12345678910111234567891011

      示例7:只顯示類型為ext3的文件系統(tǒng)

      [root@localhost ~]# df -t ext3

      Filesystem 1K-blocks Used Available Use% Mounted on

      /dev/sda2 16036224 2750464 12458012 19% /

      /dev/sda1 295561 16911 263390 7% /boot12341234

      示例8:顯示出每個文件系統(tǒng)的類型

      [root@localhost ~]# df -T

      Filesystem Type 1K-blocks Used Available Use% Mounted on

      /dev/sda2 ext3 16036224 2750464 12458012 19% /

      /dev/sda1 ext3 295561 16911 263390 7% /boot

      tmpfs tmpfs 1028272 0 1028272 0% /dev/shm1234512345

      示例9:顯示出每個文件系統(tǒng)的類型

      [root@localhost ~]# df #默認(rèn)情況是1024

      Filesystem 1K-blocks Used Available Use% Mounted on

      /dev/sda2 16036224 2750464 12458012 19% /

      /dev/sda1 295561 16911 263390 7% /boot

      tmpfs 1028272 0 1028272 0% /dev/shm

      [root@localhost ~]# export POSIXLY_CORRECT=true #設(shè)置POSIXLY_CORRECT為true

      [root@localhost ~]# df #POSIXLY_CORRECT為true時默認(rèn)512

      Filesystem 512B-blocks Used Available Use% Mounted on

      /dev/sda2 32072448 5500928 24916024 19% /

      /dev/sda1 591122 33822 526780 7% /boot

      tmpfs 2056544 0 2056544 0% /dev/shm

      [root@localhost ~]# unset POSIXLY_CORRECT #取消設(shè)置POSIXLY_CORRECT

      [root@localhost ~]# df

      Filesystem 1K-blocks Used Available Use% Mounted on

      /dev/sda2 16036224 2750464 12458012 19% /

      /dev/sda1 295561 16911 263390 7% /boot

      tmpfs 1028272 0 1028272 0% /dev/shm

    3634907