How to determine the file types from the terminal in Linux/Unix?
file command is used to determine the file types from the terminal in Linux/Unix. Most systems have by default file command available. It is a small tool which helps you quickly determine file type in Linux/Unix. It analyzes the file given as an argument and displays details about that file.
file [-bchiklLNnprsvz0] [--apple] [--mime-encoding] [--mime-type] [-e testname] [-F separator] [-f namefile] [-m magicfiles]
file -C [-m magicfiles]
[[email protected] ~]$ file name1 Outputs: name1: ASCII text
[[email protected] ~]$ file 1.txt Outputs: 1.txt: empty
[[email protected] ~]$ file numbers.tar.gz Outputs: numbers.tar.gz: gzip compressed data, from Unix, last modified: Sat Apr 15 01:39:12 2017
That’s all for now. Have questions, post them in the comments.