Linux and other Unix-like Operating systems maintain consistency by treating everything as a file (even the hardware devices). The keyboard, mouse, printers, monitor, hard disk, processes, even the directories are treated as files in Linux. The regular files contain data such as text (text files), music, videos (multimedia files), etc.
Other than regular data, there are some other data about these files, such as their size, ownership, permissions, timestamp etc. This metadata about a file is managed with a data structure known as an inode (index node).
Every Linux file or directory (from a technical point of view, there’s no real difference between them) has an inode, and this inode contains all of the file’s metadata (ie all the administrative data needed to read a file is stored in its inode).
For example, the inode contains a list of all the blocks in which a file is stored, the owner information for that file, permissions and all other attributes that are set for the file.
Inode limits is per filesystem and is decided at filesystem creation time. The maximum directory size dependent on the filesystem and thus the exact limit differs.
For better performance make your directories smaller by sorting files into subdirectories rather having one large directory.
Inode number is also known as index number. An inode is a unique number assigned to files and directories while it is created. The inode number will be unique to entire filesystem.
An inode is a data structure on a traditional Unix-style file system such as ext3 or ext4 which stores the properties of a file and directories.
Linux extended filesystems such as ext3 or ext4 maintain an array of these inodes called the inode table. This table contains list of all files in that filesystem. The individual inodes in inode table have a unique number (unique to that filesystem) called the inode number.
File type: regular file, directory, pipe etc.
Permissions to that file: read, write, execute
Link count: The number of hard link relative to an inode
User ID: owner of file
Group ID: group owner
Size of file: or major/minor number in case of some special files
Time stamp: access time, modification time and (inode) change time
Attributes: immutable' for example
Access control list: permissions for special users/groups
Link to location of file
Other metadata about the file
Symbolic links (or soft links)
Hard links
To send a signal to a process, use the kill, pkill or pgrep commands we mentioned earlier on. But programs can only respond to signals if they are programmed to recognize those signals.
And most signals are for internal use by the system, or for programmers when they write code. The following are signals which are useful to a system user:
SIGHUP 1 – sent to a process when its controlling terminal is closed.
SIGINT 2 – sent to a process by its controlling terminal when a user interrupts the process by pressing [Ctrl+C].
SIGQUIT 3 – sent to a process if the user sends a quit signal [Ctrl+D].
SIGKILL 9 – this signal immediately terminates (kills) a process and the process will not perform any clean-up operations.
SIGTERM 15 – this a program termination signal (kill will send this by default).
SIGTSTP 20 – sent to a process by its controlling terminal to request it to stop (terminal stop); initiated by the user pressing [Ctrl+Z].
Start the gedit app in the background from the terminal.
Bring it to the foreground and suspend it.
Reactive it and then terminate it.
Start Firefox. List it’s process id. Terminate it using the kill command.
Make a file named A.txt in the home directory. This file can contain some text in it. Make a symbolic link on the desktop.Then make sure to check if a link is created. Try displaying the contents of the file by using the symbolic link.
Also list the inode numbers of the linked file and the original file.
Make a file named B.txt in the home directory. This file can contain some text in it. Make a hard link on the desktop. Then list out the number of links of that file. Also list the inode numbers of the linked file and the original file.