Files and hard and soft links

Most files are regular files, containing a certain amount of data. For instance, a text file contains a sequence of human-readable characters represented by a certain encoding, while a bitmap contains some metadata about the size and the bit used for each pixel, followed by the content of each pixel. 

Files are arranged inside directories that make it possible to have different namespaces to reuse filenames. These are referred to with a name, their human-readable identifier, and organized in a tree structure. The path is a unique identifier that represents a directory, and it is made by the names of all the parents of the directory joined by a separator (/ in Unix, in Windows), descending from the root to the desired leaf. For instance if a directory named a is located under another named b, which is under one called c, it will have a path that starts from the root and concatenates all the directories, up to the file: /c/b/a.

When more than one file points to the same content, we have a hard link, but this is not allowed in all filesystems (for example, NTFS and FAT). A soft link is a file that points to another soft link or to a hard link. Hard links can be removed or deleted without breaking the original link, but this is not true for soft links. A symbolic link is a regular file with its own data that is the path of another file. It can also link other filesystems or files and directories that do not exist (that will be a broken link).

In Unix, some resources that are not actually files are represented as files, and communication with these resources is achieved by writing to or reading from their corresponding files. For instance, the /dev/sda file represents an entire disk, while /dev/stdout, dev/stdin, and /dev/stderr are standard output, input, and error. The main advantage of Everything is a file is that the same tools that can be used for files can also interact with other devices (network and pipes) or entities (processes).

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.118.23.147