Linuxls
命令带有这些选项。
--block-size=SIZE
scale sizes by SIZE before printing them; e.g., '--block-size=M' prints sizes in units of 1,048,576 bytes; see
SIZE format below
-l use a long listing format
list subdirectories recursively
-s, --size
print the allocated size of each file, in blocks
Run Code Online (Sandbox Code Playgroud)
我认为这ls -l
是实际的文件大小,ls -s --block-size=1
是分配给存储文件的磁盘空间量。(在这种情况下,991232 = 968x1024 = 968K。)
$ ls -s --block-size=1 summary.pdf
991232 summary.pdf
$ ls -l summary.pdf
-rwxrwx---. 1 chris chris 989838 May 1 2015 summary.pdf
Run Code Online (Sandbox Code Playgroud)
是否可以在没有“长列表格式”的附加信息的情况下以字节为单位获取文件大小?