Javatpoint Logo
Javatpoint Logo

Linux file command

file command is used to determine the file type. It does not care about the extension used for file. It simply uses file command and tell us the file type. It has several options.

Syntax:

Example:

Linux File Command

In above snapshot, you can see file command along with different arguments, specifying their file types.

Note: File command tell us the file type with the help of a magic file that contains all the patterns to recognize a file type. Path of magic file is /usr/share/file/magic. For more information enter the command 'man 5 magic'.

Linux File Command Options

OptionFunction
file -s Used for special files.
file * Used to list types of all the files.
file /directory name/*Used to list types of all the files from mentioned directory.
file [range]* It will list out all the files starting from the alphabet present within the given range.
Next TopicLinux File Touch




Please Share

facebook twitter google plus pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA