Get a file's type and metadata

file <filename>
Some shell newbies don't know this very handy file management related command so I decided to include it here. You need to have the "file" package installed.
Sample Output
lordtoran.png: PNG image data, 500 x 500, 8-bit/color RGB, non-interlaced

dscn1083.avi: RIFF (little-endian) data, AVI, 640 x 480, ~15 fps, video: XviD, audio: MPEG-1 Layer 3 (mono, 22050 Hz)

hyoscyamus.pdf: PDF document, version 1.4

/boot/vmlinuz-3.1.0-1-686-pae: Linux kernel x86 boot executable bzImage, version 3.1.0-1-686-pae (unknown@Debian) #1 SMP Mon Nov 14 08:24:20 UTC, RO-rootFS, swap_dev 0x2, Normal VGA

mandriva-linux-one-2010.2-KDE4-europe1-americas-cdrom-i586.iso: # ISO 9660 CD-ROM filesystem data 'One-2010.2-KDE4                 ' (bootable)

By: lordtoran
2011-11-19 23:39:29

What do you think?

Any thoughts on this command? Does it work on your machine? Can you do the same thing with only 14 characters?

You must be signed in to comment.

What's this? is the place to record those command-line gems that you return to again and again. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.

Share Your Commands

Stay in the loop…

Follow the Tweets.

Every new command is wrapped in a tweet and posted to Twitter. Following the stream is a great way of staying abreast of the latest commands. For the more discerning, there are Twitter accounts for commands that get a minimum of 3 and 10 votes - that way only the great commands get tweeted.


Subscribe to the feeds.

Use your favourite RSS aggregator to stay in touch with the latest commands. There are feeds mirroring the 3 Twitter streams as well as for virtually every other subset (users, tags, functions,…):

Subscribe to the feed for: