Types of Files in Unix
In Unix operating system, all data is organized into files. Each file is organized into directories, and these directories are organized in a tree-like structure called a file system.
The following are the types of files in Unix:
1. Ordinary Files
Ordinary files are the files in Unix, which includes program instructions, text, and data.
Directory store both special as well as ordinary files. For the users who are familiar with Mac or Windows operating systems, Unix directories are equivalent to the folders. A directory file includes an entry file for each file and a subdirectory which it houses. If there are 5 files in a directory, then there will be 5 entries in the directory. Every entry comprises of 2 components.
In the long-format output of ls -l, we used the "d" symbol in order to specify this kind of file.
3. Special Files
We use special files to represent the real physical device like terminal, tape drive, and printer. and also used for Input/Output(I/O) operations. Special files or devices are used for Input/Output(I/O) on Linux and Unix systems. They look as similar to the ordinary file or directory in a file system.
Mainly two kinds of special files for every device in the Unix system are there such as block special files and character special files.
This is one character at a time for the terminal devices. However, for disk devices, raw access means reading or writing across an entire section of data-blocks that are native to our disk.
In Unix, with the help of pipes, we can link command together. Pipes is like a temporary file that only exists to hold the data from one command till it is read by another. A one-way flow of data is provided by the Unix pipe. The first command's output sequence is used like an input to the next command sequence. In order to create a pipe, the vertical bar (|) has to be placed on the command line between 2 commands. Such as who | wc -l
In the long-format output of ls -l, known as pipes, are marked using the symbol "p."
Unix sockets are a type of file that enables for advanced inter-process communication. It is also known as inter-process communication socket. In the framework of the client-server application, a Unix Socket is used. It is essentially a data stream, same as the network stream and network socket, except each transaction is local to the file system.
In the long-format output of ls -l, using the "s" symbol, Unix sockets are marked.
6. Symbolic Link
The symbolic link is used to reference another file in the file system. In order to reference another file of the file system, we use the symbolic link. It involves a text representation of the path to the file it refers to. To an end-user, a symbolic link will seem to have its own name, yet when we need writing or reading data to this file, it will rather reference these tasks to the file it focuses to. When we delete the soft link itself, then the data file would, in any case, be there. The symbolic file will not function if the source file is deleted or moved to the different location.
In the case of the long-format output of ls -l, using the "l" symbol, the symbolic link is marked.