file Linux Commands

What is Linux file Command?

Explanation

file COMMAND:

file command tells you if the object you are looking at is a file or a directory.

SYNTAX :


file [options] directoryname/filename

OPTIONS:


-c Check the magic file for format errors. For reasons of efficiency, this validation is normally not carried out.
-h Do not follow symbolic links.
-m Use mfile as an alternate magic file.
-f ffile contains a list of the files to be examined.

EXAMPLE:


  1. file *.txt
    Output:
    aprlist.txt:
    ASCII English text cal.txt:
    ASCII text marchlist.txt: ASCII English text text.txt:
    ASCII text

    Prints the 'txt' files.
  2. file nimi
    Output:
    nimi: directory

    Print the given object nimi is an directory or file.

Ask Questions

Ask Question