

You might be wondering how we can use deck calculator (dc) for converting hex to ASCII and I will show you exactly how. Converting hex to ASCII using printf Method 3: Using dc Command

There is no issue if you get a single digit at the end of the hex string and it will work fine as demonstrated. Yes, you can convert hex to ASCII using the bash printf command. echo 4c696e757868616e64626f6f6b20313233 | xxd -r -p & echo '' Converting hex to ASCII using xxd Method 2: Using printf Command To make it more readable, you may append echo '' to the above command. :~$ echo 4c696e757868616e64626f6f6b20313233 | xxd -r -pĪs you can see above, the output gets mixed with the prompt in the terminal because the converted output doesn't have the new line character. Here, command option -r is used to convert hex code to ASCII, and -p is used to print the plain text. Xxd is a command-line utility that can create a hex dump from the given text and vice versa.įirst I'm going to input hex string using echo command and will pair it with xxd using pipe. Let's consider the following hex code (problem statement) which I want to convert: 4c696e757868616e64626f6f6b20313233Īnd if I succeed in converting the above hex code, the ASCII conversion should look like this: Linuxhandbook 123 Method 1: Using xxd Command Through this guide, I will include various ways by which you can easily convert hex to ASCII.

ASCII is a method that is used to convert normal language characters to binary so computers can understand instructions from our side. On the other hand, ASCII stands for American Standard Code for Information Interchange and has a completely different use case than Hexadecimal. You could still see it in use, especially with the Hex color pallet which is used to represent various shades of colors. Hex was extensively used in microcontrollers a few decades ago. It may sound complicated but it is still better than binary numbering where everything is 1 and 0. Hexadecimal is a number system in which you use a combination of numbers (0-9) to represent values ranging from 0 to 9 and alphabets (A-F) to represent values from 10 to 15. You may also use these methods in your shell script if required. There are multiple ways to convert hex to ASCII in Linux. Got a bunch of hexadecimal characters and want to convert them to a readable decimal system (ASCII)?
