In Linux everything is a file but not all the files are of
the same type. There are seven basic types of file types in Linux.
Regular file (-)
Directory (d)
Symbolic Link (l)
Character Device (c)
Block Device (b)
Socket files (s)
Named Pipe (p)
You can use the “ls -l” command to see the various types of
files. The first character shows the file type.
Regular file
Symbol: - Color: White
These are indicated with "-" and the following
file
1. Readable file
2. A binary file
3. Image files
4. Compressed files
You can create the regular file using the command touch or vi
or redirection operators.
Directory file
Symbol: d Color: Blue
These are regular files, folders or special files stored on
a physical device.
You can create Directory files using mkdir command.
Symbolic link files
Symbol: l Color: Cyan
Symbolic links are special files that point to either
another file or to a directory. The inode number for this file and its parent
files are same. There are two types of symbolic link soft link and hard link.
Symbolic link files can be created by ln command.
Character device files
Symbol: c
Color: Yellow
Character Devices are files where data is a stream of bytes
i.e. the input/output happens byte by byte.
Examples of these files are terminal, keyboard.
Character device files can be created by mknod command.
Block Device File
Symbol: b
Color: Yellow
Block Devices are devices, as the name suggests, deal with
blocks of data. Therefore, block device drivers are implemented to read/write
block data and also supports random access data.
Block Device files can be created by mknod command.
Socket files
Symbol: s Color: Purple
A socket file is used for inter-process communication
between applications.
Socket files can be created using socket() system call by C
programming.
Named Pipe files
Symbol: p Color: Red
A special type of file that acts more or less like sockets
and form a way for processes to communicate with each other. It is also called
FIFO (First In - First Out) means that the order of bytes going in is the same
coming out.
Named files can be created using mkfifo command.
No comments:
Post a Comment