在“pydf”(Python的磁盘文件系统 )是一种先进的命令行工具和一个很好的替代Linux的“ DF COMAND” 。 它是用来在Linux文件系统,同样喜欢df命令显示的使用和可用的磁盘空间量,但在不同的颜色。 pydf命令的输出可以根据您的需要进行自定义。
Pydf检查磁盘使用情况的命令
这种“pydf”命令被写在在Linux安装的文件系统,使用自定义的颜色不同的文件系统类型,显示磁盘使用和可用空间的量Python语言。
正在安装pydf
默认情况下,pydf工具未安装在Linux发行版上,您需要使用第三方存储库安装它。 因此,首先使EPEL软件库 ,之后启用它,使用下面的“ Yum命令 ”进行安装。
在RHEL / CentOS / Fedora / Scientific Linux上
# yum install pydf
示例输出
Loaded plugins: fastestmirror, security Determining fastest mirrors epel/metalink | 4.2 kB * base: mirror.nbrc.ac.in * epel: mirrors.ispros.com.bd * extras: mirror.nbrc.ac.in base | 3.7 kB epel | 3.9 kB epel/primary_db | 4.2 MB extras | 3.5 kB updates | 3.5 kB updates/primary_db | 1.9 MB Setting up Install Process Resolving Dependencies --> Running transaction check ---> Package pydf.noarch 0:9-3.el6 will be installed --> Finished Dependency Resolution Dependencies Resolved ================================================================================================================== Package Arch Version Repository Size ================================================================================================================== Installing: pydf noarch 9-3.el6 epel 14 k Transaction Summary ================================================================================================================== Install 1 Package(s) Total download size: 14 k Installed size: 25 k Is this ok [y/N]: y Downloading Packages: pydf-9-3.el6.noarch.rpm | 14 kB Running rpm_check_debug Running Transaction Test Transaction Test Succeeded Running Transaction Installing : pydf-9-3.el6.noarch 1/1 Verifying : pydf-9-3.el6.noarch 1/1 Installed: pydf.noarch 0:9-3.el6 Complete!
在Debian / Ubuntu / Linux Mint
在基于Debian的发行版中,pydf工具是从包管理系统速效,则可以使用“安装apt-get命令 ”,如下图所示。
$ sudo apt-get install pydf
示例输出
[sudo] password for youcl: Reading package lists... Done Building dependency tree Reading state information... Done The following package was automatically installed and is no longer required: java-wrappers Use 'apt-get autoremove' to remove it. The following NEW packages will be installed: pydf 0 upgraded, 1 newly installed, 0 to remove and 10 not upgraded. Need to get 12.1 kB of archives. After this operation, 70.7 kB of additional disk space will be used. Get:1 http://in.archive.ubuntu.com/ubuntu/ raring/universe pydf all 10 [12.1 kB] Fetched 12.1 kB in 1s (6,097 B/s) Selecting previously unselected package pydf. (Reading database ... 175568 files and directories currently installed.) Unpacking pydf (from .../apt/archives/pydf_10_all.deb) ... Processing triggers for man-db ... Setting up pydf (10) ...
如何使用pydf命令
如果没有指定参数运行只是“pydf”命令,它会与所有已安装文件系统一起显示磁盘空间使用情况的信息只。
# pydf
Filesystem Size Used Avail Use% Mounted on /dev/sda2 49G 3244M 44G 6.4 [###.....................................] / /dev/sda1 194M 43M 140M 22.4 [#########...............................] /boot /dev/sdb1 492G 345G 122G 70.2 [#########################...............] /data /dev/sda3 39G 4043M 33G 10.0 [####....................................] /home /dev/sda6 55G 33G 19G 60.0 [########################................] /var /dev/sdc1 492G 262G 205G 53.3 [#####################...................] /videos
要检查哪些文件具有0块,简单的运行与“-a”或“-ALL”的说法大致如下指挥系统。
# pydf -a
Filesystem Size Used Avail Use% Mounted on /dev/sda2 49G 3244M 44G 6.4 [##..................................] / /dev/sda1 194M 43M 140M 22.4 [########............................] /boot /dev/sdb1 492G 345G 122G 70.2 [#########################...........] /data devpts 0 0 0 - [....................................] /dev/pts tmpfs 3995M 0 3995M 0.0 [....................................] /dev/shm /dev/sda3 39G 4043M 33G 10.0 [####................................] /home proc 0 0 0 - [....................................] /proc none 0 0 0 - [....................................] /proc/sys/fs/binfmt_misc sysfs 0 0 0 - [....................................] /sys /dev/sda6 55G 33G 19G 60.0 [######################..............] /var sunrpc 0 0 0 - [....................................] /var/lib/nfs/rpc_pipefs /dev/sdc1 492G 262G 205G 53.3 [###################.................] /videos
要以可读的格式输出,使用选项“-h”,这将打印尺寸(如10K,10M,10G)。
# pydf -h
Filesystem Size Used Avail Use% Mounted on /dev/sda2 49G 3244M 44G 6.4 [###.....................................] / /dev/sda1 194M 43M 140M 22.4 [#########...............................] /boot /dev/sdb1 492G 345G 122G 70.2 [############################............] /data /dev/sda3 39G 4043M 33G 10.0 [####....................................] /home /dev/sda6 55G 33G 19G 60.0 [########################................] /var /dev/sdc1 492G 262G 205G 53.3 [#####################...................] /videos
要打印在千字节(例如,1024块的大小)选择使用“-k”,如下图所示尺寸。
# pydf -k
Filesystem Size Used Avail Use% Mounted on /dev/sda2 51606140 3321932 45662768 6.4 [##..................................] / /dev/sda1 198337 44371 143726 22.4 [########............................] /boot /dev/sdb1 516054864 362172932 127667872 70.2 [#########################...........] /data /dev/sda3 41284928 4140032 35047744 10.0 [####................................] /home /dev/sda6 57593092 34575244 20092232 60.0 [######################..............] /var /dev/sdc1 516054864 274980776 214860028 53.3 [###################.................] /videos
要打印摘要输出以兆字节(例如,1048576块大小)使用选项“-m”,如下图所示。
pydf -m
Filesystem Size Used Avail Use% Mounted on /dev/sda2 50397 3244 44593 6.4 [##.....................................] / /dev/sda1 194 43 140 22.4 [#########..............................] /boot /dev/sdb1 503960 353685 124675 70.2 [###########################............] /data /dev/sda3 40317 4043 34226 10.0 [####...................................] /home /dev/sda6 56243 33768 19618 60.0 [#######################................] /var /dev/sdc1 503960 268536 209824 53.3 [#####################..................] /videos
要打印在千兆字节(例如,1073741824)的大小,指定选项“-g”,如下图所示。
# pydf -g
Filesystem Size Used Avail Use% Mounted on /dev/sda2 50397 3244 44593 6.4 [##.....................................] / /dev/sda1 194 43 140 22.4 [#########..............................] /boot /dev/sdb1 503960 353685 124675 70.2 [###########################............] /data /dev/sda3 40317 4043 34226 10.0 [####...................................] /home /dev/sda6 56243 33770 19616 60.0 [#######################................] /var /dev/sdc1 503960 268536 209824 53.3 [#####################..................] /videos
要查看有关的inode而不是块中的信息,使用参数“-i”为如下。
# pydf -i
Filesystem Nodes Used Avail Use% Mounted on /dev/sda2 3200k 78k 3122k 2.5 [#.......................................] / /dev/sda1 50k 40 50k 0.1 [........................................] /boot /dev/sdb1 31M 411k 31M 1.3 [#.......................................] /data /dev/sda3 2560k 3031 2557k 0.1 [........................................] /home /dev/sda6 3576k 873k 2703k 24.4 [##########..............................] /var /dev/sdc1 31M 2033k 29M 6.4 [###.....................................] /videos
如果要禁用colourised输出,只需使用选项“-BW”。
# pydf --bw
Filesystem Size Used Avail Use% Mounted on /dev/sda2 49G 3244M 44G 6.4 [###.....................................] / /dev/sda1 194M 43M 140M 22.4 [#########...............................] /boot /dev/sdb1 492G 345G 122G 70.2 [############################............] /data /dev/sda3 39G 4043M 33G 10.0 [####....................................] /home /dev/sda6 55G 33G 19G 60.1 [########################................] /var /dev/sdc1 492G 262G 205G 53.3 [#####################...................] /videos
如何自定义pydf颜色
pydf有自己的配置文件,您可以在其中定义自己的自定义颜色,给出一些额外的感觉并查看输出。
# vi /etc/pydfrc
欲了解更多信息通过击中在终端“ 人pydf”读pydf命令的手册页。