How to check file type in linux ?
In our last post we saw which are the different file types in linux and how to identify different file types from ls -l output. But we have a command called file to determine the file type. file command tests each file prints the fileype. The syntax for file command is
file [options] filename
Sample Outputs
- regular text file$ file README.txt
README.txt: ASCII text
- a directory
$ file /etc
/etc: directory
- a block device file
$ file /dev/sda1
/dev/sda1: block special
- a symbolic link
$ file /bin/thunderbird
/bin/thunderbird: symbolic link to `/usr/lib/thunderbird/thunderbird'
- a character file
$ file /dev/input/event0
/dev/input/event0: character special
- named pipe file
$ file mypipe
mypipe: fifo (named pipe)
- socket file
$ file /var/lib/mysql/mysql.sock
/var/lib/mysql/mysql.sock: socket
Comments
Post a Comment