1. 程式人生 > >Linux df 命令使用詳解

Linux df 命令使用詳解

一、功能說明:顯示磁碟的相關資訊。

二、語法:df [-ahHiklmPT][--block-size=<區塊大小>][-t <檔案系統型別>][-x <檔案系統型別>][--help][--no-sync][--sync][--version][檔案或裝置]


三、補充說明:df可顯示磁碟的檔案系統與使用情形。

四、具體事例:

1、-a或--all   包含全部的檔案系統。

[[email protected] ~]# df -a
Filesystem     1K-blocks    Used Available Use% Mounted on
/dev/xvda1      41282880 1808452  37377380   5% /
proc                   0       0         0    - /proc
sysfs                  0       0         0    - /sys
devpts                 0       0         0    - /dev/pts
tmpfs             509164       0    509164   0% /dev/shm
none                   0       0         0    - /proc/sys/fs/binfmt_misc
none                   0       0         0    - /proc/xen

2、--block-size=<區塊大小>   以指定的區塊大小來顯示區塊數目。

[[email protected] ~]# df --block-size=10240
Filesystem     10K-blocks   Used Available Use% Mounted on
/dev/xvda1        4128288 180846   3737738   5% /
tmpfs               50917      0     50917   0% /dev/shm

3、-h或--human-readable   以可讀性較高的方式來顯示資訊。

[[email protected]

~]# df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/xvda1       40G  1.8G   36G   5% /
tmpfs           498M     0  498M   0% /dev/shm

4、-H或--si   與-h引數相同,但在計算時是以1000 Bytes為換算單位而非1024 Bytes。

[[email protected] ~]# df -H
Filesystem      Size  Used Avail Use% Mounted on
/dev/xvda1       43G  1.9G   39G   5% /
tmpfs           522M     0  522M   0% /dev/shm

5、-i或--inodes   顯示inode的資訊。

[[email protected] ~]# df -i
Filesystem      Inodes IUsed   IFree IUse% Mounted on
/dev/xvda1     2621440 48349 2573091    2% /
tmpfs           127291     1  127290    1% /dev/shm

6、-k或--kilobytes   指定區塊大小為1024位元組。

[[email protected] ~]# df -k
Filesystem     1K-blocks    Used Available Use% Mounted on
/dev/xvda1      41282880 1808456  37377376   5% /
tmpfs             509164       0    509164   0% /dev/shm

7、-l或--local   僅顯示本地端的檔案系統。

[[email protected] ~]# df -l
Filesystem     1K-blocks    Used Available Use% Mounted on
/dev/xvda1      41282880 1808456  37377376   5% /
tmpfs             509164       0    509164   0% /dev/shm

8、-m或--megabytes   指定區塊大小為1048576位元組。

[[email protected] ~]# df -m
Filesystem     1M-blocks  Used Available Use% Mounted on
/dev/xvda1         40316  1767     36502   5% /
tmpfs                498     0       498   0% /dev/shm

9、--no-sync   在取得磁碟使用資訊前,不要執行sync指令,此為預設值。

[[email protected] ~]# df --no-sync
Filesystem     1K-blocks    Used Available Use% Mounted on
/dev/xvda1      41282880 1808460  37377372   5% /
tmpfs             509164       0    509164   0% /dev/shm

10、-P或--portability   使用POSIX的輸出格式。

[[email protected] ~]# df -P
Filesystem     1024-blocks    Used Available Capacity Mounted on
/dev/xvda1        41282880 1808460  37377372       5% /
tmpfs               509164       0    509164       0% /dev/shm

11、--sync   在取得磁碟使用資訊前,先執行sync指令。

[[email protected] ~]# df --sync
Filesystem     1K-blocks    Used Available Use% Mounted on
/dev/xvda1      41282880 1808460  37377372   5% /
tmpfs             509164       0    509164   0% /dev/shm

12、-t<檔案系統型別>或--type=<檔案系統型別>   僅顯示指定檔案系統型別的磁碟資訊。

[[email protected] ~]# df -t tmpfs
Filesystem     1K-blocks  Used Available Use% Mounted on
tmpfs             509164     0    509164   0% /dev/shm

13、-T或--print-type   顯示檔案系統的型別。

[[email protected] ~]# df -T
Filesystem     Type  1K-blocks    Used Available Use% Mounted on
/dev/xvda1     ext3   41282880 1808468  37377364   5% /
tmpfs          tmpfs    509164       0    509164   0% /dev/shm

14、-x<檔案系統型別>或--exclude-type=<檔案系統型別>   不要顯示指定檔案系統型別的磁碟資訊。

[[email protected] ~]# df -x tmpfs
Filesystem     1K-blocks    Used Available Use% Mounted on
/dev/xvda1      41282880 1808468  37377364   5% /

15、--direct      show statistics for a file instead of mount point

[[email protected] ~]# df --direct
Filesystem     1K-blocks    Used Available Use% File
/dev/xvda1      41282880 1808468  37377364   5% /
tmpfs             509164       0    509164   0% /dev/shm

16、 --total       produce a grand total

[[email protected] ~]# df --total
Filesystem     1K-blocks    Used Available Use% Mounted on
/dev/xvda1      41282880 1808468  37377364   5% /
tmpfs             509164       0    509164   0% /dev/shm
total           41792044 1808468  37886528   5%

17、--help   顯示幫助

[[email protected] ~]# df --help
Usage: df [OPTION]... [FILE]...
Show information about the file system on which each FILE resides,
or all file systems by default.


Mandatory arguments to long options are mandatory for short options too.
  -a, --all             include dummy file systems
  -B, --block-size=SIZE  use SIZE-byte blocks
      --direct          show statistics for a file instead of mount point
      --total           produce a grand total
  -h, --human-readable  print sizes in human readable format (e.g., 1K 234M 2G)
  -H, --si              likewise, but use powers of 1000 not 1024
  -i, --inodes          list inode information instead of block usage
  -k                    like --block-size=1K
  -l, --local           limit listing to local file systems
      --no-sync         do not invoke sync before getting usage info (default)
  -P, --portability     use the POSIX output format
      --sync            invoke sync before getting usage info
  -t, --type=TYPE       limit listing to file systems of type TYPE
  -T, --print-type      print file system type
  -x, --exclude-type=TYPE   limit listing to file systems not of type TYPE
  -v                    (ignored)
      --help     display this help and exit
      --version  output version information and exit


Display values are in units of the first available SIZE from --block-size,
and the DF_BLOCK_SIZE, BLOCK_SIZE and BLOCKSIZE environment variables.
Otherwise, units default to 1024 bytes (or 512 if POSIXLY_CORRECT is set).


SIZE may be (or may be an integer optionally followed by) one of following:
KB 1000, K 1024, MB 1000*1000, M 1024*1024, and so on for G, T, P, E, Z, Y.


Report df bugs to [email protected]
GNU coreutils home page: <http://www.gnu.org/software/coreutils/>
General help using GNU software: <http://www.gnu.org/gethelp/>
For complete documentation, run: info coreutils 'df invocation'

18、--version   顯示版本資訊。

[[email protected] ~]# df --version
df (GNU coreutils) 8.4
Copyright (C) 2010 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.


Written by Torbjörn Granlund, David MacKenzie, and Paul Eggert.

相關推薦

Linux netstat命令,高級面試必備

bytes tool head osi ngs 進行 pen 通信 詳細信息 簡介 Netstat 命令用於顯示各種網絡相關信息,如網絡連接,路由表,接口狀態 (Interface Statistics),masquerade 連接,多播成員 (Multicast Mem

linux top 命令

ctrl+ 一次 所有 使用方法 ase 隱藏 統計 ini 前臺 top命令是Linux下常用的性能分析工具,能夠實時顯示系統中各個進程的資源占用狀況,類似於Windows的任務管理器。下面詳細介紹它的使用方法。top - 01:06:48 up 1:22, 1 user

【轉】linux awk命令

column 環境變量 最後一行 工作流程 初始 文本文件 for循環 其中 cti 簡介 awk是一個強大的文本分析工具,相對於grep的查找,sed的編輯,awk在其對數據分析並生成報告時,顯得尤為強大。簡單來說awk就是把文件逐行的讀入,以空格為默認分隔符將每行切

Linux ls命令

-c 目錄 輸出 限制 普通 排序 當前 ls -l sna ls 命令可以說是Linux下最常用的命令之一。 -a 列出目錄下的所有文件,包括以 . 開頭的隱含文件。(後有詳解)-b 把文件名中不可輸出的字符用反斜杠加字符編號(就象在c語言裏一樣)的形式列出。-c 輸出

linux lsof命令

open 日誌 文件和目錄 delete 數據報 正在 某個文件 alt targe 簡介 lsof(list open files)是一個列出當前系統打開文件的工具。在linux環境下,任何事物都以文件的形式存在,通過文件不僅僅可以訪問常規數據,還可以訪問網絡連接和硬件

linux tail 命令

基本 linux中 file tail命令 方式 sed 缺省 顯示 有效 linux ---tail命令 linux中tail命令---用於查看文件內容 最基本的是cat、more和less。 1. 如果你只想看文件的前5行,可以使用head命令,如: head -5 /

linux screen 命令

文本 常用 小時 遠程終端 參考 編輯 load 調整 長時間 一、背景 系統管理員經常需要SSH 或者telent 遠程登錄到Linux 服務器,經常運行一些需要很長時間才能完成的任務,比如系統備份、ftp 傳輸等等。通常情況下我們都是為每一個這樣的任務開一個遠程終端窗口

[轉載]linux awk命令

基本 特定 收集 comm rip 解釋 文本 工作流程 復制代碼 簡介 awk是一個強大的文本分析工具,相對於grep的查找,sed的編輯,awk在其對數據分析並生成報告時,顯得尤為強大。簡單來說awk就是把文件逐行的讀入,以空格為默認分隔符將每行切片,切開的部分再進行各

Linux crontab命令

條件 nta mman minute 使用 1-1 同時 刪除用戶 設置 1.crontab命令概覽      命令參數:   -u user:用來設定某個用戶的crontab服務,例如,“-u ixdba”表示設定ixdba用戶的crontab服務,此參數一般有root用

linux top命令

swa mem img 針對 alt 線程 opp 分區 緩存 Linux系統可以通過top命令查看系統的CPU、內存、運行時間、交換分區、執行的線程等信息。通過top命令可以有效的發現系統的缺陷出在哪裏。是內存不夠、CPU處理能力不夠、IO讀寫過高。

Linux netstat命令

訪問 ast osi cmp internet mtu www unix ngs Linux netstat命令詳解 簡介 Netstat 命令用於顯示各種網絡相關信息,如網絡連接,路由表,接口狀態 (Interface Statistics),masquerade 連

linux awk命令

列數 才會 遍歷數組 文本文件 信息 shell腳本 == game 入門 簡介 awk是一個強大的文本分析工具,相對於grep的查找,sed的編輯,awk在其對數據分析並生成報告時,顯得尤為強大。簡單來說awk就是把文件逐行的讀入,以空格為默認分隔符將每行切片,切開的部分

Linux route命令和使用,以及網卡命令

linux 路由 網卡一 路由的基礎知識:1)路由概念路由: 跨越從源主機到目標主機的一個互聯網絡來轉發數據包的過程路由器:能夠將數據包轉發到正確的目的地,並在轉發過程中選擇最佳路徑的設備路由表:在路由器中維護的路由條目,路由器根據路由表做路徑選擇直連路由:當在路由器上配置了接口的IP地址,並且接口狀態為

[linux]vmstat命令-顯示虛擬內存狀態

span 並不是 增加 OS 表現 如果 2個 blog IT 本文轉載於http://man.linuxde.net/vmstat vmstat命令的含義為顯示虛擬內存狀態(“Viryual Memor Statics”),但是它可以報告關於進程、內存、I/O等系統整

Linux curl命令

cookied current form eat -o party tp服務器 cap lin 命令:curl 在Linux中curl是一個利用URL規則在命令行下工作的文件傳輸工具,可以說是一款很強大的http命令行工具。它支持文件的上傳和下載,是綜合傳輸工具,但按傳統,

linux yum命令

參數 string sound 修改 最新 metadata inux dep logs linux yum命令詳解 yum(全稱為 Yellow dog Updater, Modified)是一個在Fedora和RedHat以及SUSE中的Shell前端軟件包管

Linux nmap命令

http 默認 inux ping主機 ip地址 log alt flags ipv 1,nmap命令是一款開放源代碼的網絡探測和安全審核工具,它的設計目標是快速地掃描大型網絡。 2,語法nmap(選項)(參數) 3,選項-O:激活操作探測;-P0:值進行掃描,不ping主

Linux blkid命令

tom 展示 true tool spl als bubuko root 系統類型 blkid命令對查詢設備上所采用文件系統類型進行查詢。blkid主要用來對系統的塊設備(包括交換分區)所使用的文件系統類型、LABEL、UUID等信息進行查詢。要使用這個命令必須安裝e2f

Linux mount命令

沒有 使用 OS linu rfs man lap adfs 信息 mount命令用於加載文件系統到指定的加載點。此命令的也常用於掛載cdrom,使我們可以訪問cdrom中的數據,因為你將光盤插入cdrom中,Linux並不會自動掛載,必須使用Linux mount命令來手

Linux history命令

etc 並且 目的 script oot com 退出 顯示 shell history命令用於顯示指定數目的指令命令,讀取歷史命令文件中的目錄到歷史命令緩沖區和將歷史命令緩沖區中的目錄寫入命令文件。 該命令單獨使用時,僅顯示歷史命令,在命令行中,可以使用符號!執行指