Check Linux File Type and File Format using file Command and ls Command
Using ls command to show file type.
The Linux operating system using the file type to identify and check its file format. The simple way to check the file type of any files on Linux system is using the ls command and file command. The example below demonstrate the use of the ls command and the file command to identify Linux file type.
Note: On the file permission section, the first character indicates the file type:
- <= Linux regular file
d <= Linux directory
b <= Linux block special file
c <= Linux character special file
l <= Linux symbolic link
p <= Linux named pipe
s <= Linux domain socket
The ls command with -l option as show the file in long list format including the file type, file permission and other Linux file properties as show on Linux command example below:

[root@fedora ~]# pwd
/root
[root@fedora ~]# ls -l install.log
-rw-r--r-- 1 root root 72032 2008-05-20 08:25 install.log
[root@fedora ~]#
ls command output:

Example on using ls command to display the block special file:

[root@fedora ~]# ls -l /dev/sda
brw-r----- 1 root disk 8, 0 2008-10-30 02:28 /dev/sda
[root@fedora ~]#
ls command output:

Using the file command to find Linux file type.
The Linux file command usually use to find out the Linux file type. The file command example below demonstrate the use of Linux file command to show the type of Linux file on Linux Fedora 9 machine.
Show the file type for install.log file ( regular file ) using file command:

[root@fedora ~]# pwd
/root
[root@fedora ~]# file install.log
install.log: ASCII Pascal program text
[root@fedora ~]#
Show the file type for /dev/sda device file ( block special file ) using file command:

[root@fedora ~]# file /dev/sda
/dev/sda: block special (8/0)
[root@fedora ~]#
Keywords: find file type, show file type, show Linux file type, check Linux file type, Linux file format, find Linux file type, ls command, file command
- Add new comment
- 7962 reads
- Email this page
Thanks for Reading and Check Other Popular Linux Topics
All time:
- Configure and Setup Squid Cache Proxy Server on Fedora Core.
- Using Linux rm command to delete, remove hidden files and folder - Basic Linux Command.
- Copy Linux Files and Copy Directory Using cp Command - Linux Basic Command.
- Moving or rename files and directory using Linux mv command - Basic Linux Command.
- Add, view, edit and configure route and static route on Linux Fedora Core - Linux Server Configuration.
- Get and display the size of file and directory in Linux system using du command.
- Step by step Install Setup and Configure Linux Fedora Core Server and Network Management with Screen Shot and Example.
- Create file and display file contents in Linux using cat command.
- Configure Squid to block HTTP request to specific web sites.
- Example of samba smbpasswd file and samba smbusers configuration file.

Recent comments
4 days 20 hours ago
1 week 2 days ago
5 weeks 2 days ago
10 weeks 25 min ago
10 weeks 2 hours ago
10 weeks 5 days ago
11 weeks 1 day ago
11 weeks 5 days ago
11 weeks 5 days ago
18 weeks 1 day ago