naomi / unix.md

0 polubień
0 forków
1 plików
Ostatnio aktywne 1734590476

Filesystem

The UNIX filesystem is a hierarchical collection of files and directories. Directories are containers that can contain named files or directories. A path in UNIX is separated by /, and the root of the filesystem is denoted by /, such that /foo/bar/baz refers to a file or directory named baz inside the bar directory that lives in the foo directory in the root of the filesystem.

The entries in a directory are called directory entries, dirents, or dentries. There are minor technical differences between these terms, mostly based on what level of abstraction they typically involve. A directory entry has a name and points to an inode. Typically this is a 1-to-1 correlation, but it can sometimes be useful to have two different directory entries point to the same inode -- this is called a hardlink when it does happen, and means you have two names for the same file.

An inode represents, generally, the concept of a file or directory in the filesystem. It is where all the properties of what it means to be a file live and as such, I'll use file and inode interchangeably from now on.

The filesystem can be navigated by using cd to change your current directory, and ls to list the contents of a directory (or your current directory). By convention, files starting with a . are considered hidden, and you will need to use ls -a to see them. There are two special files in each directory: . which refers to this directory and .. which refers to this directory's containing directory.

Nowsze Starsze