Linux looks at everything as a File, if something is not a File, then it is a Process.
Any Linux file systems will have many files. If you write a program, you add one more file to the system. When you compile it, you are adding at least two files in the system.
The most notable feature of the Linux file system is that Linux makes little distinction between various types of files.
There are three types of files in the Linux File System.
- Ordinary / General Files – Contains only data.
- Directory Files – Contains other files and directories.
- Device Files – Represents all hardware device.
∗ A Linux file doesn’t contain the end-of-file mark or its name.
This is the traditional definition of a file. You can put anything you want into this type of file. It includes all data, documents, source codes, objects, and executable code.
Commands like cat, ls, touch etc are treated as an ordinary file. The most common type of ordinary files is the text file.
A directory contains no external data but keeps some details of the files and sub-directories that it contains. A directory contains two fields for each file – the name of the file, and its identification number ( inode ).
You can create a directory by typing this command –
Ex- in a terminal, type ”
∗ It is the directory file that contains the names of all files resident in the directory.
Linux considers physical devices as files too. This includes printers, tapes, floppy drives, Hard Disks, Bluetooth etc.
The device file is special in the sense that any output directed to it will be reflected onto the respective physical device associated with the filename.
As you can see the color codes, the Blue texts represent it is a Directory, the Black texts represent it is an ordinary file, and the Green one represents it is an executable file.
- + –
- Regular file
- Special file
- Named pipe
- Block device