3.1.1.2. Sorts of files
Most files are just files, called regular files; they
contain normal data, for example text files, executable files or
programs, input for or output from a program and so on.
While it is reasonably safe to suppose that everything you
encounter on a Linux system is a file, there are some
exceptions.
-
Directories: files that are lists of other files.
-
Special files: the mechanism used for input and output.
Most special files are in /dev, we will
discuss them later.
-
Links: a system to make a file or directory visible in
multiple parts of the system's file tree. We will talk about links
in detail.
-
(Domain) sockets: a special file type, similar to
TCP/IP sockets, providing inter-process networking protected by the
file system's access control.
-
Named pipes: act more or less like sockets and form a
way for processes to communicate with each other, without using
network socket semantics.
The -l option to ls displays the file type, using the first character
of each input line:
jaime:~/Documents> ls -l
total 80
-rw-rw-r-- 1 jaime jaime 31744 Feb 21 17:56 intro Linux.doc
-rw-rw-r-- 1 jaime jaime 41472 Feb 21 17:56 Linux.doc
drwxrwxr-x 2 jaime jaime 4096 Feb 25 11:50 course
|
This table gives an overview of the characters determining the
file type:
Table 3-1. File types in a long list
Symbol |
Meaning |
- |
Regular file |
d |
Directory |
l |
Link |
c |
Special file |
s |
Socket |
p |
Named pipe |
b |
Block device |
In order not to always have to perform a long listing for seeing
the file type, a lot of systems by default don't issue just
ls, but ls -F, which suffixes file names with one of the
characters "/=*|@" to indicate the file
type. To make it extra easy on the beginning user, both the
-F and --color
options are usually combined, see
Section 3.3.1.1. We will use
ls -F throughout
this document for better readability.
As a user, you only need to deal directly with plain files,
executable files, directories and links. The special file types are
there for making your system do what you demand from it and are
dealt with by system administrators and programmers.
Now, before we look at the important files and directories, we
need to know more about partitions.