Skip to content

File command

lists mimetype & file encoding

`file “filename”``

list the encoding such as ASCII or UTF-8 of a file
-i option : display the mime type als well
-b option do not dispay file name

file current-nota.txt
current-nota.txt: UTF-8 Unicode text

file -i current-nota.txt
current-nota.txt: text/plain; charset=utf-8

file -bi current-nota.txt
text/plain; charset=utf-8

verschil tussen
file /mnt/temp/transfer.xps => Microsoft OOXML
en
file -bi /mnt/temp/transfer.xps => application/octet-stream; charset=binary

change file encoding

iconv -f [encoding] -t [encoding] -o [newfilename] [filename]