为了账号安全,请及时绑定邮箱和手机立即绑定

Linux命令

标签:
Linux

ls 命令中的所有选项

-a, --all                  do not ignore entries starting with .---------------------不忽略以...开头的词条(列出所有文件,包括隐藏文件)
  -A, --almost-all           do not list implied . and ..		------------------------------不列出隐含的 "." 和 ".."。
      --author               with -l, print the author of each file-----------------------使用"-l"选项时,打印每个文件的作者
  -b, --escape               print C-style escapes for nongraphic characters--------------打印C语言风格的转义字符
      --block-size=SIZE      with -l, scale sizes by SIZE when printing them;-------------在使用"-l"选项时,按照指定的大小(SIZE)对文件大小进行缩放后再打印出来
                               e.g., '--block-size=M'; see SIZE format below----以M为单位指定块大小,例如使用'--block-size=M'。在下方可以查看SIZE格式的说明。
  -B, --ignore-backups       do not list implied entries ending with ~ -------------------不要列出以"~"结尾的隐含条目
  -c                         with -lt: sort by, and show, ctime (time of last
                               modification of file status information); -----------------使用"-lt"选项时,按照ctime(文件状态信息的最后修改时间)进行排序并显示。
                               with -l: show ctime and sort by name;----------------------使用"-l"选项时,显示ctime(文件状态信息的最后修改时间)并按名称进行排序。
                               otherwise: sort by ctime, newest first---------------------的意思是如果不使用"-l"选项,则按照ctime(文件状态信息的最后修改时间)进行排序,最新的文件先显示。
  -C                         list entries by columns--------------------------------------按列方式列出条目
      --color[=WHEN]         colorize the output; WHEN can be 'always' (default
                               if omitted), 'auto', or 'never'; more info below---------是给输出添加颜色;WHEN(何时)可以是 'always'(总是,如果省略则为默认值)、'auto'(自动)或 'never'(从不);下面有更多的信息。
  -d, --directory            list directories themselves, not their contents--------------只列出目录本身,而不包含它们的内容
  -D, --dired                generate output designed for Emacs' dired mode----------生成适用于Emacs的"dired mode"的输出
  -f                         do not sort, enable -aU, disable -ls --color ----------------不进行排序,启用"-aU"选项,禁用"-ls"和"--color"选项。
  -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------------------"across -x" 和 "horizontal -x" 的意思相同,都表示横向显示输出结果。文件或目录会从左至右、从上至下依次排列,填满整行后换行。
                                                                                          "commas -m" 表示使用逗号对数字进行千位分隔,以提高数字的可读性。例如,数字 1000000 可以显示为 1,000,000。
                                                                                          "long -l" 和 "verbose -l" 的意思相同,表示以长格式显示文件或目录。长格式会显示更多详细信息,例如权限、所有者、文件大小和修改日期等。
                                                                                          "single-column -1" 表示以单列方式展示结果,每个条目占据一行。这种方式适用于需要逐个查看条目的情况。
                                                                                          "verbose -l" 表示以详细模式显示文件或目录的信息,类似于长格式,通常提供更多的详细信息。
                                                                                          "vertical -C" 表示以竖向方式显示输出结果。文件或目录会从上至下排列,并在达到一定数量后自动换行。
      --full-time            like -l --time-style=full-iso--------------------------------使用长格式并以ISO 8601完整时间样式显示文件的时间信息。
  -g                         like -l, but do not list owner-------------------------------似于"-l"选项,但不要列出文件或目录的所有者信息。
      --group-directories-first
                             group directories before files;------------------------------将目录在文件之前进行分组。
                               can be augmented with a --sort option, but any-------------可以使用一个 "--sort" 选项来扩充命令,但没有特定的要求或限制。
                               use of --sort=none (-U) disables grouping------------------如果使用 "--sort=none" 或 "-U" 选项,则会禁用分组功能。
  -G, --no-group             in a long listing, don't print group names
  -h, --human-readable       with -l and -s, print sizes like 1K 234M 2G etc.-------------使用"-l"和"-s"选项时,以类似于1K、234M、2G等格式打印文件大小。
      --si                   likewise, but use powers of 1000 not 1024--------------------同样使用以1000为基数而不是1024来打印文件大小。
  -H, --dereference-command-line
                             follow symbolic links listed on the command line-------------命令行上列出的符号链接(symbolic link)上进行跟踪。
      --dereference-command-line-symlink-to-dir
                             follow each command line symbolic link-----------------------跟踪命令行中的每个符号链接。
                               that points to a directory---------------------------------指向一个目录的符号链接。
      --hide=PATTERN         do not list implied entries matching shell PATTERN-----------不显示与给定的shell模式匹配的隐含条目。
                               (overridden by -a or -A)-----------------------------------指定的选项或功能会被 "-a" 或 "-A" 覆盖。
      --hyperlink[=WHEN]     hyperlink file names; WHEN can be 'always'---------为文件名创建超链接;'WHEN' 参数可以设置为 'always'。
                               (default if omitted), 'auto', or 'never'----有三种可选的取值,分别是“(如果省略)默认值”,'auto'和'never'。
      --indicator-style=WORD  append indicator with style WORD to entry names:------------将指定样式的指示器添加到条目名称中:
                               none (default), slash (-p),
                               file-type (--file-type), classify (-F)---------------------"none"表示不添加任何指示器,这是默认行为。
                                                                                          "slash"使用斜杠(/)作为指示器,通常标识目录。
                                                                                          "file-type"使用文件类型作为指示器,具体显示取决于操作系统和命令行工具。
                                                                                          "classify"添加特定符号或字符作为指示器,以区分不同类型的文件,如"@"表示符号链接(symbolic link),"*"表示可执行文件等。
  -i, --inode                print the index number of each file--------------------------打印每个文件的索引号。
  -I, --ignore=PATTERN       do not list implied entries matching shell PATTERN-----------是不要列出与给定的shell模式匹配的隐含条目。
  -k, --kibibytes            default to 1024-byte blocks for disk usage;------------------在计算磁盘使用情况时默认采用1024字节的块大小。
                               used only with -s and per directory totals-----------------该选项仅与 "-s" 和每个目录的总数一起使用。
  -l                         use a long listing format0-----------------------------------使用一个长格式来显示列表信息(显示目录下内容的详情信息)
  -L, --dereference          when showing file information for a symbolic
                               link, show information for the file the link
                               references rather than for the link itself-----------------在显示符号链接的文件信息时,展示链接所引用的实际文件的信息,而不是链接本身的信息。
  -m                         fill width with a comma separated list of entries------------用逗号分隔的条目列表填充指定的宽度。
  -n, --numeric-uid-gid      like -l, but list numeric user and group IDs-----------------像 "-l" 一样列出文件详细信息,但同时显示数值形式的用户和组ID。
  -N, --literal              print entry names without quoting----------------------------在打印条目名称时,不添加引号。
  -o                         like -l, but do not list group information-------------------"-l" 一样列出文件详细信息,但不显示组信息。
  -p, --indicator-style=slash
                             append / indicator to directories----------------------------在目录名称后添加斜线(/)指示符。
  -q, --hide-control-chars   print ? instead of nongraphic characters---------------------以问号(?)代替非可打印字符的打印输出。
      --show-control-chars   show nongraphic characters as-is (the default,
                               unless program is 'ls' and output is a terminal)--按原样显示非可打印字符(默认行为,除非程序是 'ls' 并且输出是终端)。
  -Q, --quote-name           enclose entry names in double quotes--------------------------用双引号将条目名称括起来。
      --quoting-style=WORD   use quoting style WORD for entry names:-----------------------为条目名称使用指定的引号风格
                               literal, locale, shell, shell-always,
                               shell-escape, shell-escape-always, c, escape----------------literal:以字面方式输出条目名称,不进行任何引号或转义。
                                                                                           locale:按照本地环境的语言设置和约定进行引号处理。
                                                                                           shell:基于Shell的规则,在需要时使用合适的引号进行包装。
                                                                                           shell-always:与shell风格类似,但无论是否需要都会使用引号。
                                                                                           shell-escape:类似于shell风格,但还会对特殊字符进行转义。
                                                                                           shell-escape-always:与shell-escape风格类似,但无论是否需要都会使用引号。
                                                                                           c:使用C语言的转义规则来处理条目名称。
                                                                                           escape:将需要转义的字符进行转义处理。
                               (overrides QUOTING_STYLE environment variable)--------------(覆盖 QUOTING_STYLE 环境变量)
  -r, --reverse              reverse order while sorting-----------------------------------在排序时倒序排列
  -R, --recursive            list subdirectories recursively-------------------------------递归地列出所有的子目录
  -s, --size                 print the allocated size of each file, in blocks--------------以块为单位打印每个文件的分配大小。
  -S                         sort by file size, largest first------------------------------按文件大小进行排序,最大的文件排在前面。
      --sort=WORD            sort by WORD instead of name: none (-U), size (-S),
                               time (-t), version (-v), extension (-X)---------------------根据指定的单词(WORD)而不是名称进行排序。下面是一些可用的选项:
                                                                                           none (-U): 不按任何特定顺序进行排序。
                                                                                           size (-S): 根据文件大小进行排序,从最小到最大。
                                                                                           time (-t): 根据文件的时间戳(例如修改时间或访问时间)进行排序。
                                                                                           version (-v): 根据文件名中的版本号进行排序。
                                                                                           extension (-X): 根据文件扩展名(即文件名中的后缀)进行排序。
      --time=WORD            with -l, show time as WORD instead of default
                               modification time: atime or access or use (-u);-------------使用 "-l" 选项时,将时间以单词形式显示,而不是默认的修改时间。还可以选择以下选项来指定时间类型:
                                                                                           atime or access or use (-u):以文件的访问时间作为时间类型进行显示。
                               ctime or status (-c); also use specified time---------------显示文件的时间戳时使用 ctime 或状态时间,并且可以使用指定的时间。
                               as sort key if --sort=time (newest first)-------------------如果使用了 "--sort=time" 选项(最新的在前),则将指定的时间作为排序键。
      --time-style=TIME_STYLE  time/date format with -l; see TIME_STYLE below--------------在使用 "-l" 选项时,可以通过查看 TIME_STYLE 参数来指定时间/日期的格式。
  -t                         sort by modification time, newest first-----------------------按照文件的修改时间对文件进行排序,最新的文件排在前面。
  -T, --tabsize=COLS         assume tab stops at each COLS instead of 8--------------------指定制表符(Tab)在每个 COLS(列)处停靠,而不是默认的每8列一个制表符的方式。
  -u                         with -lt: sort by, and show, access time;---------------------使用 -lt 选项,在显示文件列表时按访问时间进行排序,并显示访问时间。
                               with -l: show access time and sort by name;-----------------在使用 -l 选项时,显示文件的访问时间,并按名称进行排序。
                               otherwise: sort by access time, newest first----------------按访问时间排序,最新的在前
  -U                         do not sort; list entries in directory order------------------不进行排序,按照目录中的顺序列出条目
  -v                         natural sort of (version) numbers within text-----------------在文本中对(版本)数字进行自然排序。
  -w, --width=COLS           set output width to COLS.  0 means no limit-------------------将输出宽度设置为 COLS(列)。其中,0 表示没有限制输出的宽度。
  -x                         list entries by lines instead of by columns-------------------按行而不是按列列出条目。
  -X                         sort alphabetically by entry extension------------------------按文件扩展名的字母顺序进行排序。
  -Z, --context              print any security context of each file-----------------------打印每个文件的安全上下文(security context)
  -1                         list one file per line.  Avoid '\n' with -q or -b---将文件逐行列出,使用 -q 或 -b 参数来避免显示换行符 '\n'。
      --help     display this help and exit------------------------------------------------显示帮助信息并退出程序。
      --version  output version information and exit---------------------------------------输出版本信息并退出程序。
点击查看更多内容
TA 点赞

若觉得本文不错,就分享一下吧!

评论

作者其他优质文章

正在加载中
  • 推荐
  • 评论
  • 收藏
  • 共同学习,写下你的评论
感谢您的支持,我会继续努力的~
扫码打赏,你说多少就多少
赞赏金额会直接到老师账户
支付方式
打开微信扫一扫,即可进行扫码打赏哦
今天注册有机会得

100积分直接送

付费专栏免费学

大额优惠券免费领

立即参与 放弃机会
意见反馈 帮助中心 APP下载
官方微信

举报

0/150
提交
取消