linux中查看文件或者目录大小

2019-03-10 01:02|来源: 书生

linux查看一个文件或才目录的大小,可以用命令:du -hs 文件名或目录名称


我们来看看linxu的帮助文件du --help


Usage: du [OPTION]... [FILE]...

 or:  du [OPTION]... --files0-from=F

Summarize disk usage of each FILE, recursively for directories.


Mandatory arguments to long options are mandatory for short options too.

 -a, --all             write counts for all files, not just directories

     --apparent-size   print apparent sizes, rather than disk usage; although

                         the apparent size is usually smaller, it may be

                         larger due to holes in (`sparse') files, internal

                         fragmentation, indirect blocks, and the like

 -B, --block-size=SIZE  use SIZE-byte blocks

 -b, --bytes           equivalent to `--apparent-size --block-size=1'

 -c, --total           produce a grand total

 -D, --dereference-args  dereference only symlinks that are listed on the

                         command line

     --files0-from=F   summarize disk usage of the NUL-terminated file

                         names specified in file F;

                         If F is - then read names from standard input

 -H                    equivalent to --dereference-args (-D)

 -h, --human-readable  print sizes in human readable format (e.g., 1K 234M 2G)

     --si              like -h, but use powers of 1000 not 1024

 -k                    like --block-size=1K

 -l, --count-links     count sizes many times if hard linked

 -m                    like --block-size=1M

 -L, --dereference     dereference all symbolic links

 -P, --no-dereference  don't follow any symbolic links (this is the default)

 -0, --null            end each output line with 0 byte rather than newline

 -S, --separate-dirs   do not include size of subdirectories

 -s, --summarize       display only a total for each argument

 -x, --one-file-system    skip directories on different file systems

 -X, --exclude-from=FILE  exclude files that match any pattern in FILE

     --exclude=PATTERN    exclude files that match PATTERN

     --max-depth=N     print the total for a directory (or file, with --all)

                         only if it is N or fewer levels below the command

                         line argument;  --max-depth=0 is the same as

                         --summarize

     --time            show time of the last modification of any file in the

                         directory, or any of its subdirectories

     --time=WORD       show time as WORD instead of modification time:

                         atime, access, use, ctime or status

     --time-style=STYLE  show times using style STYLE:

                         full-iso, long-iso, iso, +FORMAT

                         FORMAT is interpreted like `date'

     --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 DU_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 du bugs to bug-coreutils@gnu.org

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 'du invocation'



相关问答

更多
  • 文件系统操作命令: 1. cat:可以显示文件的内容(经常和more搭配使用),或将多个文件合并成一个文件。 2. chgrp:用来改变文件或目录所属的用户组,命令的参数以空格分开的要改变属组的文件列表,文件名支持通配符,如果用户不是该文件的所有者,则不能改变该文件的所属组。 3. chmod:用于改变文件或目录的访问权限,该命令有两种用法:一种是使用图形化的方法,另一种是数字设置法。 4. chown:用来将指定用户或组为特定的所有者。用户可以设置为用户名或用户ID,组可以是组名或组ID。特定的文件是以空 ...
  • 显示当前目录所有文件大小的命令ls -lht 1 在命令框 输入命令:ls -lht 将会一一列出当前目录下所有文件的大小,以及所有文件大小的统计总和。或者直接打入ll命令。 2 使用du -sh * 命令也可以列出当前文件以及文件夹的大小。这个命令要注意:sh与*之前要有个空格的。列出home目录所有文件大小的总和命令为:du -s /home或du -sh /home
  • # du -sh xly/ 6.4G xly/ 如果看目录下所有文件 # du -sh xly/* ............
  • ls 列出所在目录文件和文件夹。 比较基本的命令,这样怎么行。 建议预备一个命令行或者HTML的帮助文件甚至百度百科系统地用一两个小时学习一遍,也就差不多够用了。
  • u命令用来查看目录或文件所占用磁盘空间的大小。常用选项组合为:du -sh 一、du的功能:`du` reports the amount of disk space used by the specified files and for each subdirectory (of directory arguments). with no arguments,`du` reports the disk space for the current directory。 很明显,与df不同,它用来查看文件或目 ...
  • 这个通过df命令是可以看到的 假设你要看当前目录挂载的是哪个磁盘 就用这个命令 df -h . 然后在Filesystem下面就是磁盘信息,mounted on就是目录信息
  • du -sh dirname -s 仅显示总计 -h 以K、M、G为单位,提高信息的可读性。KB、MB、GB是以24为换算单 位, -H以0为换算单位。 可以多关.注《Linux就该这么学》这本书,我都是从这里面学到的
  • 命令只会显示文件的大小,而文件夹及其子目录或文件的大小不会显示。[root@hadoop01 soft]# ll -htotal 2.1G-rw-r--r--. 1 root root 51M Oct 4 2015 apache-flume-1.6.0-bin.tar.gz-rw-r--r--. 1 root root 89M Mar 14 2016 apache-hive-1.2.1-bin.tar.gz-rw-r--r--. 1 root root 7.7M Oct 24 20:14 apache-ma ...
  • 我们一般使用du命令来查看目录或文件的大小,我一般喜欢使用du –sh 文件名或目录名来查看文件或目录的大小,你自己可以使用看一下。Linux知识体系非常的复杂,围绕着linux系统管理,linux服务架构。我们需要打好坚实的基础,尤其是这个基础部分,需要有一本入门的教科书籍,帮你理通知识体系,帮你打开Linux大门,因此我给你推荐刘遄老师的《linux就该这么学》,希望你能学好linux。 89.有时候我在Linux中看到以“.文件名”开头的文件,有什么具体的含义吗? 答:这是Linux系统的隐藏文件,我 ...
  • 在linux系统下使用ls可以查看当前目录的所有文件,ls -l可以查看所有文件并附加的所有信息; 如果想要linux目录下所有的文件,可以使用ls的-R选项: ls -R 这样显示出来的是系统中所有的文件,如果需要显示所有目录文件,可以用egrep将目录文件筛选出来, ls -R|egrep ./ 这样就能查看linux下的所有目录文件了