12 January 2012

Types of Files in Linux/Unix

Leave a Comment
File types in Linux


                           There are basically 7 types of file in Linux. These are

1. Regular file : Symbol for these types of files is dash(-). These types of files mainly contain data like executable, information etc.

-rw-r--r-- 1  sandeep  sandeep  31   2012-01-01  20:10  abc.lst
-rw-r--r-- 1  sandeep  sandeep  54   2012-01-01  20:31  cut1
-rw-r--r-- 1  sandeep  sandeep  357 2011-10-02  14:14  examples.desktop

* The first character of ls -l represents file type , in this case it is dash(-).


 2. Directory file : Symbol for these types of files is d.  These types of files can be used as a container which contains others files and directories.

drwxr-xr-x 2  sandeep  sandeep  4096  2011-12-27 13:44  css
drwxr-xr-x 3  sandeep  sandeep  4096  2012-01-03 19:50  css1
drwxr-xr-x 3  sandeep  sandeep  4096  2012-01-07 10:56  Desktop
drwxr-xr-x 4  sandeep  sandeep  4096  2011-10-05 18:38  Documents

3. Symbolic link file : Symbol for these types of file is l . These types of files point to another file or directory. It is like shortcut of a file or directory.

lrwxrwxrwx 1 root  root  33  2011-11-26 09:59  initrd.img -> boot/initrd.img-2.6.32-35-generic
lrwxrwxrwx 1 root  root  33  2011-10-07 12:11  initrd.img.old -> boot/initrd.img-2.6.32-34-generic


4. Named pipes: Symbol for these types of file is p. These types of files can be used for inter-process communication  without using network semantics.

prwxr-xr-x 2  sandeep  sandeep  4096  2011-12-27 13:44  named_pipe

5. Socket file : Symbol for these types of file is s.  These types of files can be used for inter-process communication  networking protected by the file system's access control.


srwxr-xr-x 2  sandeep  sandeep  4096  2011-12-27 13:44  socket_file

Device files : In Linux every device is in the form of file whether it is printer , keyboard etc. These files are present in /dev directory. These are of two types

1. Character device file : Symbol for these types of file is c. These type of device provide only serial input or output on character basis. Example keyboard , printer , terminal etc.

crw-------  1 root root      5,   1 2012-01-13 09:21 console
crw-rw----  1 root root      1,  11 2012-01-13 09:20 kmsg

2. Buffered device file :  Symbol for these types of file is b. These type of device provide random input or output on block basis. Example cd-rom , hard-disk etc.

brw-rw---- 1 root disk 1, 1 2012-01-13 09:20 ram1
brw-rw---- 1 root disk 1, 10 2012-01-13 09:20 ram10
brw-rw---- 1 root disk 1, 11 2012-01-13 09:20 ram11

If You Liked This Post Please Take a Time To Share This Post

You May Also Like...

0 comments:

Post a Comment