Skip to content

Linux check file encoding – How to?

I switched to Mint (a distro based on Ubuntu), a while ago on my main work machine (hence the Linux related poss on my blog). I am still a newbie and need to do a lot of Googling to find how to accomplish certain tasks. I had to find the encoding of an html file today and spent a good 10 minutes finding the terminal command. Note that I am not talking about the encoding declaration that you find in the meta tag, I am trying to find the encoding of the text file.

If I was on Windows, the file would be open in Notepad and File > Save As would be a quick way to check the current file encoding.

As usual Linux had an easy command to display the information that I needed. The complicated part was to find that command.

To display the file encoding on Linux run the following command:

file -bi yourfile.html

Categories: Linux tips.

Tags: , , ,

Comment Feed

No Responses (yet)

Some HTML is OK

or, reply to this post via trackback.