Overview of Unix File System:
In this tutorial, we will dive deep into Unix File System. The file system is central to how Unix organizes information, and all the information that needs to be stored and retrieved uses the file system.
In this tutorial, we cover Unix file structure, types of files, along with different file permissions for files and directories.
This tutorial is divided into 5 parts.
Unix File Manipulations Tutorials:
- File Manipulations Part A
- File Manipulations Part B
- File Manipulations Part C
- File Manipulations Part D
- File Manipulations Part E
Unix Video #6:
File Manipulations
The information is organized in files and directories. A directory is a collection of files and other directories. Information about these files and directories are stored in a tree of inodes. The inode contains information about where to access the file, the access permissions for the file, and an inode number.
The inodes are structured as a hierarchical tree with a single root directory (“/”) at the top.
Multiple disk drives and other devices can be ‘mounted’ at a directory along with the tree (E.g. the first disk drive may be mounted to the root directory – “/”). These devices will have their own physical file system for organizing the contained information (E.g. ext4 – the fourth extended filesystem is a filesystem that is used in Linux).
It is also possible to mount virtual filesystems along the tree (E.g. the /proc directory is used to access the information about processes).
In order to enable all types of information to be stored as files, Unix supports a number of file types:
#1) Ordinary Files
These files contain binary or text information and are stored in a directory on a disk drive.
#2) Directory Files
These are used to organize a group of files – the contained files may be of any type.
#3) Special Files
Special files, also known as device files, are used to represent physical devices such as a printer, a disk drive, or a remote terminal.
#4) Named Pipes
Named pipes are used to allow one process to send information to another. These are temporary files that hold information from one process until it is read by another process.
#5) Symbolic Links
These are the files that reference some other file or directory with an absolute or relative path.
The ‘ls’ command is used to list filenames and other associated data. With the option ‘ls -il’, this command lists out a long format of file details along with its inode number.
Example:
inode-num | flags | links | owner | group size | access-date | name |
---|---|---|---|---|---|---|
2 | drwxr-xr-x | 24 | root root | 4096 | Mar 15 06:21 | . |
2 | drwxr-xr-x | 24 | root root | 4096 | Mar 15 06:21 | .. |
262147 | drwxr-xr-x | 2 | root root | 4096 | Feb 10 18:30 | bin |
393218 | drwxr-xr-x | 3 | root root | 4096 | Mar 15 06:22 | boot |
302031 | drwxrwxr-x | 2 | root root | 4096 | Feb 7 00:24 | cdrom |
2 | drwxr-xr-x | 18 | root root | 3940 | Mar 14 22:17 | dev |
262145 | drwxr-xr-x | 130 | root root | 12288 | Mar 17 06:15 | etc |
Hope you enjoyed the video!!