Quick Tip: File Command in Terminal

Sometimes you have a file, which you have no idea what type of data is contained in it. Perhaps it was originally saved incorrectly or had no extension provided. A simple way to determine the data type, is to use the file command. For example, if I created a simple text file in vi called ‘test’, and used the command file test in terminal it would output test: ASCII text.

Big deal, right? However this command could be very useful if I had a friend send me the same text file but instead of saving it as ‘test’ they saved it incorrectly as ‘test.jpg’. Now when I run the command file test, the terminal correctly outputs test: ASCII text, and gives me the needed information about what type of data is actually saved in the file.

Next time you have a mystery file, try this command. It might save you some headaches.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s