Quick, reliable conversions between character encodings on the command line. 03.01.2026 | reading time: 2 min Broken characters after moving files between systems are a nuisance; iconv fixes that by converting text from one character encoding to another on the command line. A concrete conversion ```sh # create a Latin-1 file with an umlaut printf 'Müller ' > note-latin1.txt # convert from ISO-8859-1 to UTF-8 iconv -f ISO-8859-1 -t UTF-8 note-latin1.txt -o note-utf8.txt # inspect raw bytes to see the change hexdump -C note-latin1.txt 00000000 4d fc 6c 6c 65 72 0a |M..ller.| 00000007 hexdump -C note-utf8.txt 00000000 4d c3 bc 6c 6c 65 72 0a |M..ller.| 00000008 ``` Options you will use Use `-f` and `-t` to set source and target encodings and `-o` to write output to a file; append `//TRANSLIT` to try approximate replacements and `//IGNORE` to drop unconvertible characters, and on GNU iconv `-c` can omit invalid bytes, while piping lets you convert streams with `iconv -f OLD -t NEW < in > out`. When conversions get tricky Detect an unknown encoding with `file -i` or tools like `enca` or `uchardet` before converting, be mindful of BOMs and UTF-16 byte order (specify `UTF-16`, `UTF-16LE` or `UTF-16BE`), and remember that transliteration is not always perfect so always verify with a viewer that understands the target encoding. Other tools to know For tasks beyond simple conversion use `recode` for batch transformations, `uconv` (ICU) for advanced Unicode operations and `file` or `enca` for encoding detection, and combine them with editors or scripts when conversions must be repeated or conditioned by file type. Final challenge Convert a small corpus of sample files between encodings, inspect byte-level changes, and script the steps; then try a few edge cases like mixed encodings and BOMs to build confidence and prepare for deeper Linux certification work at bitsandbytes.academy. Join Bits & Bytes Academy First class LINUX exam preparation. utilities scripting troubleshooting