ls命令选项详解

ls [-参数]

--version 在标准输出上输出版本信息并退出

ls (GNU coreutils) 8.22

Copyright (C) 2013 Free SoftwareFoundation, Inc.

License GPLv3+: GNU GPL version 3 or later<http://gnu.org/licenses/gpl.html>.

This is free software: you are free tochange and redistribute it.

There is NO WARRANTY, to the extentpermitted by law.

Written by Richard M. Stallman and DavidMacKenzie.

--help 在标准输出上显示帮助信息

对应参数如下:

  -a,--all                  do not ignoreentries starting with .

-a 列出目录下所有文件,包括以.开头的隐含文件

  -A,--almost-all           do not listimplied . and ..

     --author               with -l,print the author of each file

-A 显示除“.”和”..”外的所有文件

  -b,--escape               print C-styleescapes for nongraphic characters

     --block-size=SIZE      scale sizesby SIZE before printing them; e.g.,

                               '--block-size=M'prints sizes in units of

                               1,048,576 bytes; see SIZE format below

-b 将文件名中不可输出的字符用反斜杆加字符编号的形式列出

  -B,--ignore-backups       do not listimplied entries ending with ~

-B 不输出以“~”结尾的备份文件

 -c                         with-lt: sort by, and show, ctime (time of last

                               modification offile status information);

                               with -l: showctime and sort by name;

                               otherwise: sortby ctime, newest first

-c 输出文件的i节点的修改时间,并以此排序

 -C                         listentries by columns

     --color[=WHEN]         colorizethe output; WHEN can be 'never', 'auto',

                               or 'always' (thedefault); more info below

-C 按列输出,纵向排序

  -d,--directory            list directoriesthemselves, not their contents

-d 将目录象文件一样显示,而不显示其下的文件

  -D,--dired                generate outputdesigned for Emacs' dired mode

-D 产生适合Emacs的dired模式使用的结果

 -f                         do not sort, enable -aU,disable -ls –color

-f 对输出的文件不排序

  -F,--classify             append indicator(one of */=>@|) to entries

     --file-type            likewise,except do not append '*'

     --format=WORD          across -x,commas -m, horizontal -x, long -l,

                               single-column-1, verbose -l, vertical -C

     --full-time            like -l--time-style=full-iso

-F 在每个文件名后附上一个字符以说明改文件的类型。“*”:表示可执行的普通文件;“/”:表示目录;“@”:表示符号链接;“|”:表示FIFOs;“=”:表示套接字

 -g                         like-l, but do not list owner

     --group-directories-first

                            groupdirectories before files;

                               can be augmentedwith a --sort option, but any

                               use of--sort=none (-U) disables grouping

-g 类似-l,但不现实文件所有者 

  -G,--no-group             in a long listing,don't print group names

-G 输出文件的组的信息

  -h,--human-readable       with -l, printsizes in human readable format

                               (e.g., 1K 234M2G)

     --si                   likewise,but use powers of 1000 not 1024

-h 以可读形式显示文件大小

  -H,--dereference-command-line

                             follow symboliclinks listed on the command line

     --dereference-command-line-symlink-to-dir

                             follow eachcommand line symbolic link

                               that points to adirectory

      --hide=PATTERN         do not list implied entries matchingshell PATTERN

                               (overridden by-a or -A)

     --indicator-style=WORD  appendindicator with style WORD to entry names:

                               none (default),slash (-p),

                               file-type(--file-type), classify (-F)

-H 使用命令列中的符号链接指示的真正目的地

  -i,--inode                print the indexnumber of each file

-i 输出文件的i节点的索引信息

  -I,--ignore=PATTERN       do not listimplied entries matching shell PATTERN

-I 忽略对应的模式

  -k,--kibibytes            default to 1024-byte blocks for disk usage

-k 以KB(亲子节)为单位显示文件大小

 -l                         use along listing format

-l 显示文件的详细信息

  -L,--dereference          when showing fileinformation for a symbolic

                               link, showinformation for the file the link

                              references rather thanfor the link itself

-L 列出链接文件名而不是链接到的文件

 -m                         fillwidth with a comma separated list of entries

-m:横向输出文件名,以“,”作为分隔符

  -n,--numeric-uid-gid      like -l, but listnumeric user and group IDs

-n 用数字的UID,GID代替名称

  -N,--literal              print raw entrynames (don't treat e.g. control

                               charactersspecially)

-N 不限制文件长度

 -o                         like-l, but do not list group information

-o 显示文件的除组信息外的详细信息

  -p,--indicator-style=slash

                             append / indicatorto directories

-p 在每个文件名后附上一个字符以说明改文件的类型。“*”:表示可执行的普通文件;“/”:表示目录;“@”:表示符号链接;“|”:表示FIFOs;“=”:表示套接字

  -q,--hide-control-chars   print ? instead ofnongraphic characters

     --show-control-chars   shownongraphic characters as-is (the default,

                               unless programis 'ls' and output is a terminal)

-q 用?代替不可输出的字符

  -Q,--quote-name           enclose entrynames in double quotes

     --quoting-style=WORD   use quotingstyle WORD for entry names:

                               literal, locale,shell, shell-always, c, escape

  -r,--reverse              reverse orderwhile sorting

-r 对目录反向排序

  -R,--recursive            listsubdirectories recursively

-R 递归处理,将指定目录下的所有文件及子目录一并处理

  -s,--size                 print theallocated size of each file, in blocks

-s 在每个文件名后输出该文件的大小

 -S                         sort byfile size

     --sort=WORD            sort byWORD instead of name: none (-U), size (-S),

                               time (-t),version (-v), extension (-X)

     --time=WORD            with -l,show time as WORD instead of default

                               modificationtime: atime or access or use (-u)

                              ctime orstatus (-c); also use specified time

                               as sort key if--sort=time

     --time-style=STYLE     with -l,show times using style STYLE:

                               full-iso,long-iso, iso, locale, or +FORMAT;

                               FORMAT isinterpreted like in 'date'; if FORMAT

                               isFORMAT1<newline>FORMAT2, then FORMAT1 applies

                               to non-recentfiles and FORMAT2 to recent files;

                               if STYLE isprefixed with 'posix-', STYLE

                               takes effectonly outside the POSIX locale

-S 以文件大小排序

 -t                         sort bymodification time, newest first

-t 以文件修改时间排序

  -T,--tabsize=COLS         assume tab stopsat each COLS instead of 8

 -u                         with-lt: sort by, and show, access time;

                               with -l: showaccess time and sort by name;

                               otherwise: sortby access time

-u 以文件上次被访问的时间排序

 -U                         do not sort; list entries indirectory order

-U 对输出的文件不排序

 -v                         naturalsort of (version) numbers within text

  -w,--width=COLS           assume screenwidth instead of current value

 -x                         listentries by lines instead of by columns

-x 按列输出,横向排序

 -X                         sortalphabetically by entry extension

-X 以文件扩展名排序

 -1                         listone file per line

-1 一行只输出一个文件

--color=no 不显示彩色文件,其中蓝色:目录;绿色:可执行文件;红色:压缩文件;浅蓝色:链接文件;灰色:其他文件

 

 

Logo

瓜分20万奖金 获得内推名额 丰厚实物奖励 易参与易上手

更多推荐