Get File MIME Type from Command Line
I've gotten skilled at shell scripting over the years. I love a good GUI but knowing how to automate makes you a much more powerful engineer. Much of my scripting requires recursing over directories and processing a file if it meets a given criteria, which is often file extension or MIME type.
You can use the following shell command to get a file's MIME type:
file --mime-type -b Downloads/main.js
file --mime-type -b Downloads/logo.jpg
It's important to use the brief (
-b) option in the command or you may receive an error message.
MIME type is used for validation and any number of other informational use cases. Luckily the
file command and and a flag is all you need!
Your early CSS books were instrumental in pushing my love for front end technologies. What was it about CSS that you fell in love with and drove you to write about it?
At first blush, it was the simplicity of it as compared to the table-and-spacer...
Chances are that any Web designers using our Ghostlab browser testing app, which allows seamless testing across all devices simultaneously, will have worked with responsive design in some shape or form. And as today's websites and devices become ever more varied, a plethora of responsive images...
We've all used word processing applications like Microsoft Word and if there's one thing they've taught you it's that you need to save every few seconds in anticipation of the inevitable crash. WordPress has mimicked this functionality within their WYSIWYG editor and I use it...