File Types
UNIX files can contain important data and executable programs or they can represent devices, directories, or pointers to other files. This section looks at the different types of files available under UNIX.
Determining a File's Type
You can determine a file's type by using the -l option of the ls command. When this option is specified the output of ls contains a file's type and its attributes in addition to its name. For example, the command
$ ls –l /home/ranga/.profile
produces the following output:
-rwxr-xr-x 1 ranga users 2368 Jul 11 15:57 .profile*
As you can see, the very first character in the output is a hyphen (-). This indicates that this is a regular file. For special files, the first character is one of the letters given ...
Get Sams Teach Yourself Shell Programming in 24 Hours, Second Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.