美文网首页
linux 查看文件大小

linux 查看文件大小

作者: JeremyL | 来源:发表于2018-05-07 22:29 被阅读30次

ls

ls可以用来查看目录下文件与子目录信息

$ ls -lh
total 6.9G
-rw-rw-r-- 1 root root 531M Jul 12  2017 test1.txt
-rw-rw-r-- 1 root root 438M Jul 12  2017 test2.txt

查看指定文件信息

$ ls -lh test1.txt test2.txt
-rw-rw-r-- 1 root root 531M Jul 12  2017 test1.txt
-rw-rw-r-- 1 root root 438M Jul 12  2017 test2.txt

du

du是专门显示文件或目录大小信息的命令

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

  -0, --null            end each output line with 0 byte rather than newline
  -a, --all    #每个文件
      --apparent-size   #文件大小
  -B, --block-size=SIZE  scale sizes by SIZE before printing them.  E.g.,
                           '-BM' prints sizes in units of 1,048,576 bytes.
                           See SIZE format below.
  -b, --bytes     
  -c, --total   #总的大小
  -D, --dereference-args  dereference only symlinks that are listed on the
                          command line
  -d, --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
      --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  #自动使用K,M,G
  -k                    like --block-size=1K
  -L, --dereference     dereference all symbolic links
  -l, --count-links     count sizes many times if hard linked
  -m                    like --block-size=1M
  -P, --no-dereference  don't follow any symbolic links (this is the default)
  -S, --separate-dirs   do not include size of subdirectories
      --si              like -h, but use powers of 1000 not 1024
  -s, --summarize       display only a total for each argument
  -t, --threshold=SIZE  exclude entries smaller than SIZE if positive,
                          or entries greater than SIZE if negative
      --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'
  -X, --exclude-from=FILE  exclude files that match any pattern in FILE
      --exclude=PATTERN    exclude files that match PATTERN
  -x, --one-file-system    skip directories on different file systems
      --help     display this help and exit
      --version  output version information and exit

$du -h #显示当前文件和目录大小
812K    a.txt
444K    ./count

$ du -h *
531M    test1.sam
438M    test2.sam
$ du -h test1.sam
531M    test1.sam

相关文章

  • linux 查看文件大小

    ls ls可以用来查看目录下文件与子目录信息 查看指定文件信息 du du是专门显示文件或目录大小信息的命令

  • Linux:查看文件大小

    查看系统整体磁盘使用情况 查看某目录下文件大小

  • Linux查看文件大小

    一般使用df和du命令查看。 其中df可以查看一级文件夹大小,使用比例,档案系统及挂载点。 du 可以根据参数查看...

  • Linux 查看文件大小

    1. stat 命令 stat指令:文件/文件系统的详细信息显示。 stat命令主要用于显示文件或文件系统的详细信...

  • 一些常用的 linux 指令(一)

    linux 查看硬盘容量 查询当前目录下前 5 个最大的文件大小信息 查询当前路径下各个文件大小 查询所有硬盘文件...

  • 【Linux】查看空间、文件大小

    一.查看空间使用情况 Filesystem Size Used Avail Use% Mounted ...

  • 解决磁盘已满

    linux磁盘空间用满的处理方法 ll -h 以Kb单位列出文件df -ah 查看目录文件大小linux下空间满可...

  • Linux查看文件大小du命令

    du [-abcDhHklmsSx] [-L <符号连接>][-X <文件>][--block-size][--e...

  • Linux服务器运维

    关闭虚拟机防火墙: 查看文件大小:do -sh [文件名] 删除全部: rm -rf * linux常用命令: 基...

  • Pandas读取文件的效率-CSV VS Pickle

    读取csv文件 查看文件大小 查看本地文件大小 查看占用内存大小 查看每一列占用内存大小 object 类型占用内...

网友评论

      本文标题:linux 查看文件大小

      本文链接:https://www.haomeiwen.com/subject/caebrftx.html