For command ls

   -F, --classify
          append indicator (one of */=>@|) to entries

Wikipedia says * represents executable and / dir. Regular files are not followed by any of the above symbols.

But * follows text file and pdf file too. Are they executables?

Do the -F indicators always mean same as the first field in -rwxrwx---?

It seems like there is no difference between hardlinks and the files in either the -F indicators or the first field in -rwxrwx---. How do you distinguish them?


  • Text, PDF, image, etc. files being executable is a common symptom of files having been transferred from, or stored on, a FAT filesystem, which has no notion of an 'executable bit', so the Unix FAT driver errs on the side of functionality and marks everything as executable. – zwol Jul 27 '14 at 13:16

ls -F will:

Write a ( '/' ) immediately after each pathname that is a directory, an ( '*' ) after each that is executable, a ( '|' ) after each that is a FIFO, and an at-sign ( '@' ) after each that is a symbolic link.

GNU ls includes additional signals:

... ‘=’ for sockets, ‘>’ for doors

= is also present in the major BSDs (FreeBSD, OpenBSD, NetBSD, OS X). All of those but OpenBSD also include % for whiteouts. Most of the commercial Unices include =, but it is non-standard.

A * will appear after a file if it is marked as executable — that is, if the executable bit is set. It doesn't necessarily mean you could actually run the file. You can unset the executable bit with chmod -x; generally you won't want text files and PDFs to be executable, so you could do that. Executable files will also have the x in ls -l output.

For the others:

  • / indicates a directory, which is pretty straightforward.
  • | indicates a FIFO, which is a named pipe made with mkfifo (data can be written into it, and read back exactly once).
  • @ indicates a symbolic link made with ln -s, which is an alias for another path.
  • = indicates a socket, a special file for communicating with other processes.
  • > for doors is another inter-process communication feature from some systems.
  • % for whiteouts indicates a special file used to mark deletions made in upper layers of a union filesystem stack.

A "regular file" is what you'd conventionally think of as a file, one that you can write data into and read it back later. Alternatively, you can think of it as anything that isn't in one of the above categories.

Hard links are not distinguished from other files at all, either in ls -F output or otherwise. In fact, you can think of every file as a hard link to itself. You can look at the number of links to a given file in the ls -l output. The second field is the number of links:

-rw-r--r-- 3 root root  92766 Feb 20 11:42 test.txt

This file has three links. None of them is the "main" link, and you can't tell which one is the original in any way. If you delete one, the count will go down, but the others will still refer to the same file.

All of the -F indicators other than * do map onto one of the values of the first field of the mode output in ls -l, but there are additional values that can appear there as well, notably b for block devices, c for character devices, and other system-specific indicators.

| improve this answer | |
  • in fact, you can think of every file as a hard link to itself ...is very well said. You can get ls to distinguish them kind of though - as much as is possible, i guess. The $LS_COLORS environment variable can be configured with a mh=...: value for tagging filenames that have a value greater than one in their link count. – mikeserv Jul 27 '14 at 4:43

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.