Unix File System

File Types

Besides ordinary files, a directory is a special file in Unix®. A symbolic link is a file that points to another file, much like a shortcut in WindowsTM. In Unix® devices are also accessible as files, which can be character devices or block devices. A block device transfers one block at a time, whereas a character device transfers one character at a time.


Unix® provides two kinds of links, namely, soft links and hard links.A soft link is a special file that contains the location of the original file. A hard link, on the other hand, is a directory entry that points to the "i-node" of the file. The term i-node stands for information node (or index node), which is essentially a block that contains information about a file including its physical location on disk. Each i-node contains a link count. When a file is created the link count is set to one. When a hard link is made, the link counts goes up by one. When a hard link is removed, the link count decreases by one.


A pipe is a mechanism for programs to communicate each other. A pipe in Unix® is represented by '|' symbol. For example, for executing the command "ls | more", the program, ls generates output and the output is piped to the program "more", which displays the output on the screen one page at a time. The individual programs do not have to be designed anything differently for communicating each other. They receive input from standard input and generates output on the standard output. The pipe is handled by the Unix® kernel and does not have a specific name. Thus, it is called an unnamed pipe.

Unix® also lets you create named pipes. The following command will create a named pipe:

mkfifo pipe

In some systems, you have to use "mknod" command to create a named pipe. Once the named pipe has been created, processes can write to it or read from it much like a normal file. For example:

cat > pipe
cat pipe

The first cat writes to the pipe and the second cat reads from it.

You may share this article on Facebook.