Unix file types |
Unix file types
For normal files in the file system, Unix does not impose or provide any internal file structure. This implies that from the point of view of the operating system, there is only one file type.
The structure and interpretation thereof is entirely up to the application associated with the file.
Unix does however have some special files. These special files are most easily recognised with the ls -l command which shows the type encoded as the first alphabetic letter in the file system permissions field. A normal file is indicated by a dash ( - ) symbol.
=Special file directory =
The most common special file is the directory. The layout of a directory file is defined by the file system used. As several files systems, both native and non-native, are available under Unix, there is not one directory file layout. In the permissions field the file type character is a d as in drwxr-xr-x / .
=Special file symbolic link =
Symbolic links are references to other files. This special file contains a textual representation of the path to a referenced file. They are very alike to the so called shortcuts under the Microsoft Windows operating system.
In the permissions string you can recognize a symbolic link by the first character l (lower case L) of link.
lrwxrwxrwx 1 root root 23 2005-01-23 14:39 termcap -> /usr/share/misc/termcap
=Special file named pipe =
One of the strengths of Unix has always been interprocess communication. Amongst the facilities provided by the OS are so called pipes. These pipes connect the output of one Unix process to the input of another. This is fine if both processes are living in the same parent process space, started by the same user. There are however circumstances where the communicating processes must used named pipes. One such circumstance is that the processes have to be executed under different user names and permissions.
These named pipes are special files that can exist anywhere in the file system. These named pipe special files are made with the command mkfifo as in mkfifo mypipe . A named pipe special file is recognisable by the file type character p as in prw-rw---- mypipe .
=Special file device file =
In Unix almost all things are handled as files and have a location in the file system. The great exception here are network devices that do not turn up in the file system but are handled separately.
These files are used to apply access rights and to direct operations on the files to the appropriate device drivers.
Unix makes a distinction between character devices and block devices. The distinction is roughly as follows:
|
|