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 ( */=>@| ) ?

1

2 Answers 2

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'.

5
  • 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 Jun 30, 2016 at 11:03
  • 2
    Where is the "official Unix/Linux" list of these indicator entries types? Sep 29, 2021 at 23:20
  • 1
    @ManuelJordan, see another answer (in short: info ls) Feb 20, 2022 at 0: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, 2023 at 14:53
  • My comment relates to the attached answer, not to default configurations. Aug 23, 2023 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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .