60

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

  • 2
    Have you thought of looking at the man page? – mdpc Jul 9 '13 at 17:20
  • 22
    He has. In fact, he posted an excerpt from the manpage. The full ls documentation, including information about the symbols displayed by ls -F, is in a Texinfo manual. (info ls). – user26112 Jul 9 '13 at 17:33
  • 1
    On a side note, since Texinfo manuals generally feel strange and foreign, it's common to keep around functions like these: infos () { info --vi-keys --subnodes -o - "$@" | less; }. – user26112 Jul 9 '13 at 17:37
  • 1
    @EvanTeitelman This is great information, I will keep info foo --vi-keys in mind. Unfortunately the syntax you mentioned does not work for me (infos () { info --vi-keys...} – spuder Jul 9 '13 at 17:44
  • 1
    @spuder: It's a function; you have to call it. infos ls. The $@ part passes all of the function's arguments to info. You can put this function in your ~/.bashrc file for later use. – user26112 Jul 9 '13 at 17:56
62

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

  • 9
    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
  • On Android I get a completely two column output. I get the filename or directory name and BEFORE the name there is a minus if it is file, or a "d" if it is a directory, or a "ld" if it is a link. It is a disaster that Linuxes are so inconsistent! – Elmue Jun 1 '18 at 16:31
0

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#ls-invocation

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.