Linux file command

The file command is used to check a file’s type and contents in Linux environment. It is most commonly used in bash scripts and in this article we will show you the basic usage of the Linux file command.

Display info about a file

This will display a text with the file’s description, for example, “HTML document, UTF-8 Unicode text, with very long lines” or “Zip archive data, at least v2.0 to extract”

file myFile.txt # => myFile.txt: ASCII text

Viewing mime type

file -i database.sql # => database.sq: text/html; charset=utf-8

You can also try to look into an archive

file -z myArchive.tar.gz
  • 0 أعضاء وجدوا هذه المقالة مفيدة
هل كانت المقالة مفيدة ؟

مقالات مشابهة

Linux tar Command

The Linux tar command is used to compress and extract files to and from an archive. In this...

Linux top command

If you wish to monitor the performance of your VPS or Dedicated server and track processes, RAM...

Linux ping command

If you wish to test your connection to a server from your Linux system you can use the Linux ping...

Linux export command

When you’re managing your shell’s variables and you wish to save them to your environment you can...

Linux su command

The su command is most commonly used to switch to another user. You will then be able to run...