There is only one command you need to know, which will help you to identify and categorize all the seven different file types found on the Linux system.
# ls -ld <filename>
ls command will show the file type as an encoded symbol found as the first character of the file permission part.
It is important to point out that Linux file types are not to be mistaken with file extensions.
Seven different types of Linux file types and
ls command identifiers:
The regular file is a most common file type found on the Linux system. It governs all different files such us text files, images, binary files, shared libraries, etc.
# ls -ld /etc/resolv.conf
-rw-r--r--. 1 root root 54 Jul 3 13:37 /etc/resolv.conf
Directory is second most common file type found in Linux.
# ls -ld /etc
drwxr-xr-x. 138 root root 8192 Jul 3 13:37 /etc
Character device file
Character and block device files allow users and programs to communicate with hardware peripheral devices.
# ls -ld /dev/zero
crw-rw-rw-. 1 root root 1, 5 Jul 3 13:37 /dev/zero
Block device file
Block devices are similar to character devices. They mostly govern hardware as hard drives, memory, etc.
# ls -ld /dev/vda
brw-rw----. 1 root disk 252, 0 Jul 3 13:37 /dev/vda
Local socket file
Local domain sockets are used for communication between processes. Generally, they are used by services such as X windows, syslog and etc.
# ls -ld /dev/log
srw-rw-rw-. 1 root root 0 Jul 3 13:37 /dev/log
Similarly as Local sockets, named pipes allow communication between two local processes. A named pipe can be used to transfer information from one application to another without the use of an intermediate temporary file.
With symbolic links an administrator can assign a file or directory multiple identities. Symbolic link can be though of as a pointer to an original file. There are two types of symbolic links:
# ls -ld /dev/rtc
lrwxrwxrwx. 1 root root 4 Jul 3 13:37 /dev/rtc -> rtc0