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!
CSS has become more and more powerful over the past few years and CSS transforms are a prime example. CSS transforms allow for sophisticated, powerful transformations of HTML elements. One or more transformations can be applied to a given element and transforms can even be animated...