Home > Articles > Operating Systems, Server > Linux/UNIX/Open Source

This chapter is from the book

This chapter is from the book

Visually Display a File’s Type

ls -F

The ls command doesn’t tell you much about an item in a directory besides its name. By itself, it’s hard to tell if an item is a file, a directory, or something else. An easy way to solve this problem and make ls really informative is to use the -F option (or --classify).

$ ls -F ~/bin
adblock_filters.txt   fixm3u*        pix2tn.pl*
addext*               flash.xml*     pop_login*
address_book.csv      getip*         procmail/
address_book.sxc      homesize*      programs_usual*
address_book.xls      html2text.py*  quickrename*
backup_to_chaucer*    list-urls.py*

This tells you quite a bit. An * or asterisk after a file means that it is executable, while a / or forward slash indicates a directory. If the filename lacks any sort of appendage at all, it’s just a regular ol’ file. Other possible endings are shown in Table 2.1.

Table 2.1 Symbols and File Types

Character

Meaning

*

Executable

/

Directory

@

Symbolic link

|

FIFO (AKA a named pipe)

=

Socket

  • + Share This
  • 🔖 Save To Your Account