104

I noticed that if I run ls -F on a directory, some of the entries have a * or a @ after them.

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/  

According to the ls man pages

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

I'm guessing that @ means symbolic link,

What do these other indicators mean ( */=>@| ) ?

spuder
  • 18,053

2 Answers2

113

ls -F appends symbols to filenames. These symbols show useful information about files.

If you want this behavior to be the default, add this to your shell configuration: alias ls='ls -F'.

  • 16
    do not realias commands, it can break badly written scripts. I have aliased l to have -F and colour, and ll to also have -l – ctrl-alt-delor Jun 30 '16 at 11:03
  • 2
    Where is the "official Unix/Linux" list of these indicator entries types? – Manuel Jordan Sep 29 '21 at 23:20
  • 1
    @ManuelJordan, see another answer (in short: info ls) – Martian2020 Feb 20 '22 at 00:42
  • 1
    @ctrl-alt-delor I'd agree with you except that many shells are distributed with aliases in-box for many commands anyway, including ls, e.g. MINGW64/Git-Bash-for-Windows has alias ls='ls -F --color=auto --show-control-chars'. I'm of the opinion that badly written scripts should be corrected instead of ultimately compromising our UX and QoL to accommodate those scripts. – Dai Aug 19 '23 at 14:53
  • My comment relates to the attached answer, not to default configurations. – ctrl-alt-delor Aug 23 '23 at 14:33
9

Just to add how I found this info. As indicated at the bottom of man ls:

Full documentation at: https://www.gnu.org/software/coreutils/ls or available locally via: info '(coreutils) ls invocation'

Following this, we see

‘-F’ ‘--classify’ ‘--indicator-style=classify’ Append a character to each file name indicating the file type. Also, for regular files that are executable, append ‘*’. The file type indicators are ‘/’ for directories, ‘@’ for symbolic links, ‘|’ for FIFOs, ‘=’ for sockets, ‘>’ for doors, and nothing for regular files. Do not follow symbolic links listed on the command line unless the --dereference-command-line (-H), --dereference (-L), or --dereference-command-line-symlink-to-dir options are specified.

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

flow2k
  • 611
  • 1
  • 10
  • 19