5.4 Listing Directory Contents
5.4.3 Displaying file types
When using the ls command by itself, you can obtain a listing of directory contents but cannot tell which are files and which are directories. By using the ls command with the -F (File type) option, you can display a listing with a symbol to indicate the file type. The symbol (if present) is found at the end of the file or directory name. Note that the -F option is an upper case F. There are four UNIX file types: Directory, Executable, ASCII text file and Symbolic link. We will focus on the first three in this course.
  • Directory - A forward slash (/) after the name indicates this is a directory (or subdirectory). A directory is considered a type of file with UNIX.
  • ASCII Text File - If there is no symbol after the name, this indicates a plain ASCII text file with no formatting characters. (ASCII is the American Standard Code for Information Interchange) An ASCII text file is similar to a DOS text file.
  • Executable - An asterisk (*) after the name indicates that this is a command, an application or a script file which can be run or executed.
  • Symbolic Link - An at sign (@) after the name indicates a symbolic link which is a way of giving a file an alternate name. Symbolic links will not be covered in this course.

Figure shows two examples using the ls -F command to see the file type and assumes you are in your home directory /home/user2. The first example shows only files and directories. The second shows a symbolic link, an executable, an ASCII text file, and a directory.

Interactive Media Activity (Flash, 95 kB)
  Displaying File Types

In this media activity, you are logged in as user2 and your current working directory is: /home/user2/dir1. Refer to the Class File Tree Structure by clicking the 'tree' button located on the Menu Bar and type the commands that would accomplish the requested objectives. 
Note: Be sure to press enter after each one. Click on step 1 to begin.