Linux FILE command explained



Linux does not require file name extensions to classify files by type. The File command scans the beginning of a file’s contents and displays what type it is. The files to be classified are passed as arguments to the command.


What is the file command?

The file command determines the file type of a file. It reports the file type in human readable format.


How to determine the file type of a file

[root@CentOs ~]# file /etc/passwd

Linux How to determine the file type of a file

to show only file type just put the -b option

[root@CentOs ~]# file -b /etc/passwd


to show only file type just put the -b option


How to determine the file type of multiple files?

The file command can also operate on multiple files and will output a separate line to standard output for each file.

[root@CentOs ~]# file /etc/p*

How to determine the file type of multiple files?

For more details see man page




Tech info

Comments