Here is how to determine the mime-type for a given file on the command line.
OS X
file --mime '''filename''
Linux
xdg-mime query filetype '''filename''' gvfs-info -a standard::content-type '''filename''' | grep content | cut -d: -f4 | cut -d\ -f2- gnomevfs-info '''filename''' | grep MIME | cut -d\: -f2- | cut -d\ -f2- file --mime '''filename''' | cut -d\: -f2- | cut -d\ -f2
Everywhere
Update: We can modify the conditional alias to support mime types as well:
conditional_alias2 () {
UNSET=false
alias $1 > /dev/null 2>&1 || UNSET=true
[ $UNSET = true ] && which $2 > /dev/null 2>&1 && alias $1=$3
}
mime_gvfs() {
gvfs-info -a standard::content-type $1 | grep content | cut -d: -f4 | cut -d\ -f2-
}
mime_xdg() {
xdg-mime query filetype $1
}
mime_gnomevfs() {
gnomevfs-info file://$PWD/$1 | grep MIME | cut -d\: -f2- | cut -d\ -f2-
}
conditional_alias2 mime gvfs-info mime_gvfs
conditional_alias2 mime xdg-mime mime_xdg
conditional_alias2 mime gnomevfs-info mime_gnomevfs
nice post.
ReplyDeletehttps://calendar.clemson.edu/event/introduction_to_gis_1602#.XHjIrYgzbIU
http://quanticalabs.com/wp_themes/themis-theme/in-metus-felis-tempor-mattis/#cpage-1
https://bandzone.cz/soutez/pecka-vyhraj-lupeny-na-aerodrome-festival
https://activerain.com/blogsview/4468493/maybe-a-meme-
http://www.juntadeandalucia.es/averroes/centros-tic/23700293/helvia/bitacora/index.cgi