In Linux/UNIX, ever thing is a file. Here devices, drivers etc., are treated as files.
The following are the types of files available in Linux / UNIX.
1. Regular (or) Ordinary (or) ASCII text files.
2. Directory files.
3. Device files
Types of device files:
Ex: keyboard, mouse, monitor etc.,
Ex: cdrom, floppy, hard disk etc.,
4. Linked files
Types of linked files:
5. Empty files
6. Socket files
7. Tar files
8. Binary executable files
9. Cpio files (copy archive file in and out)
10. Zip files
There are many ways to figure out what type of file it is.
Using "file" command we can find out if it’s a file or directory etc.
By using ls –l (longlist format) command also we can determine the type of the file.
The starting letter of ls -l output, in each and every line indicates the type of the file.
[root@sys2 sbin]# ls -l
-rwxr-xr-x. 1 root root 10704 Jul 10 2012 accton
-rwxr-xr-x. 1 root root 8456 Jan 9 2013 addpart
-rwxr-xr-x. 1 root root 23952 Jan 9 2013 agetty
drwxr-xr-x. 1 root root 23952 Jan 9 2013 Sampdir
lrwxrwxrwx. 1 root root 7 Jan 22 01:30 clock ->hwclock
In the above outputs the first letter in each and every line indicates the type of the file
- Regular file or ASCII text file
d Directory file or device file
c character special file
b block special file
l linked file
s socket file