ls -F 显示的符号是什么意思?

spu*_*der 84 ls

我注意到如果我在目录上运行 ls -F ,某些条目后面会有 * 或 @ 。

spuder@ubuntu:~$ ls -F /sbin
acpi_available*   getpcaps*           lvmconf*                 ntfscp*        start-stop-daemon*
agetty*           getty*              lvmdiskscan@             ntfslabel*     status@
alsa*             halt@               lvmdump*                 ntfsresize*    stop@
alsactl*          hdparm*             lvmsadc@    

spuder@ubuntu:~$ ls -F ~
daq-0.6.1/  examples.desktop       noname-cache.lib  snort-2.9.1/   Templates/
Desktop/    jpgraph-1.27.1/        noname.sch        snortfiles/    Ubuntu One/
Documents/  
Run Code Online (Sandbox Code Playgroud)

根据 ls 手册页

spuder@ubuntu:~$ man ls
...
-F, --classify
  append indicator (one of */=>@|) to entries
...
Run Code Online (Sandbox Code Playgroud)

我猜这@意味着符号链接,

这些其他指标是什么意思 ( */=>@|) ?

小智 95

ls -F将符号附加到文件名。这些符号显示有关文件的有用信息。

如果你想这种行为是默认的,添加到您的shell配置:alias ls='ls -F'

  • 不要 realias 命令,它可以破坏写得很糟糕的脚本。我将 `l` 别名为 -F 和 color,并将 `ll` 别名为 -l (11认同)
  • 这些指标条目类型的“官方 Unix/Linux”列表在哪里? (2认同)

flo*_*w2k 8

只是添加我如何找到此信息。如底部所示man ls

\n
\n

完整文档位于:https://www.gnu.org/software/coreutils/ls \ 也不能通过以下方式在本地获取: info \'(coreutils) ls incalling\'

\n
\n

接下来,我们看到

\n
\n

\xe2\x80\x98-F\xe2\x80\x99 \xe2\x80\x98--classify\xe2\x80\x99 \xe2\x80\x98--indicator-style=classify\xe2\x80\x99 附加每个文件名的\n字符指示文件类型。另外,对于可执行的常规文件,请附加 \xe2\x80\x98*\xe2\x80\x99。文件类型指示符为\n目录的\xe2\x80\x98/\xe2\x80\x99、符号链接的\xe2\x80\x98@\xe2\x80\x99、\xe2\x80\x98|\xe2\x80 \x99 用于 FIFO,\xe2\x80\x98=\xe2\x80\x99 用于套接字,\n\xe2\x80\x98>\xe2\x80\x99 用于门,对于常规文件没有任何内容。不要遵循命令行上列出的\n符号链接,除非 --dereference-command-line\n(-H)、--dereference (-L) 或 --dereference-command-line-symlink-to-dir\未指定任何选项。

\n
\n

https://www.gnu.org/software/coreutils/manual/coreutils.html#General-output-formatting

\n