Useful Snippets

Useful Snippets


This blog is used to collect useful snippets related to Linux, PHP, MySQL and more. Feel free to post comments with improvements or questions!

August 2020
M T W T F S S
 12
3456789
10111213141516
17181920212223
24252627282930
31  

Categories


Recognize the format of any file using the file command!

Stanislav KhromovStanislav Khromov

The file command provides you useful information about any file.

For example, here is the output for a text file:

file license.txt
license.txt: ASCII English text, with CRLF line terminators

And here is one for a binary file. (The whoami util.)

file /usr/bin/whoami
/usr/bin/whoami: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.15, stripped

Lots of good information regarding the CPU architecture (Intel i386)

And here is the output using an image file:

file zenhub.png
zenhub.png: PNG image data, 900 x 699, 8-bit/color RGB, non-interlaced

file is truly a great utility and I can see myself using it quite a bit in the future. :)

Web Developer at Aftonbladet (Schibsted Media Group)
Any opinions on this blog are my own and do not reflect the views of my employer.
LinkedIn
Twitter
WordPress.org Profile
Visit my other blog

Comments 0
There are currently no comments.