首页 > linux shell 命令 df -ahP 这个P是什么意思?

linux shell 命令 df -ahP 这个P是什么意思?

网上有说是POSIX格式 这个到底是干嘛用的?


参考man reference可以看出,-b(作用相同-P), -k, -m or -g这些参数分别对应以不同的块大小(Block Size),512-bytes-block, kilobytes, megabytes or gigabytes来计算disck free space.

从-h 和 -H两个参数选项中可以看出,这些不同的BLOCKSIZE只是为了以不同的基数计算出磁盘可用空间,以用户友好的方式显示出来。

BLOCKSIZE的大小按照一定的优先级来确定:
如果在本次命令中设置了BLOCKSIZE的大小,例如-b -k -h等等,则使用相应的大小;
否则,本次程序运行在SHELL的环境变量中看是否设置了BLOCKSIZE的大小,如果有,则使用;
e.g.

ME-Macbook-Pro:Downloads me$ export BLOCKSIZE=728
ME-Macbook-Pro:Downloads me$ df
Filesystem    728-blocks      Used Available Capacity  Mounted on
/dev/disk0s2   291989320 289193340   2475980   100%    /
devfs                364       364         0   100%    /dev
map -hosts             0         0         0   100%    /net
map auto_home          0         0         0   100%    /home

最后,默认使用512-bytes-block;

-b Use (the default) 512-byte blocks. This is only useful as a way to override an BLOCKSIZE specification from the environment.
-g Use 1073741824-byte (1-Gbyte) blocks rather than the default. Note that this overrides the BLOCKSIZE specification from the environment.
-k Use 1024-byte (1-Kbyte) blocks, rather than the default. Note that this overrides the BLOCKSIZE specification from the environment.
-m Use 1048576-byte (1-Mbyte) blocks rather than the default. Note that this overrides the BLOCKSIZE specification from the environment.
-P Use (the default) 512-byte blocks. This is only useful as a way to override an BLOCKSIZE specification from the environment.
-H "Human-readable" output. Use unit suffixes: Byte, Kilobyte, Megabyte, Gigabyte, Terabyte and Petabyte in order to reduce the number of digits to three or less using base 10 for sizes.

-h "Human-readable" output. Use unit suffixes: Byte, Kilobyte, Megabyte, Gigabyte, Terabyte and Petabyte in order to reduce the number of digits to three or less using base

2 for sizes.


我看man里面的说明是这样的:

-P Use (the default) 512-byte blocks. This is only useful as a way to override
an BLOCKSIZE specification from the environment.

使用多少个512byte blocks代替显示空间大小,有什么用,我也不知道。

【热门文章】
【热门文章】