Linux file command with example

Linux file command with example

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:

  1. file <filename>  

1) How to determine the file type of a file

# file Karun.txt 
File.txt: ASCII text

2)How to determine filesystem type of partition using file command
 the -s flag enables reading of block or character files .

# file –s /dev/sda1
/dev/sda1: SGI XFS filesystem data (blksz 4096, inosz 256
, v2 dirs)

No comments:

Post a Comment