This worked for me.

$ echo -n 54657374696e672031203220330 | xxd -r -p
Testing 1 2 3$

echo -n prevents a newline from being added to the end

-r tells it to convert hex to ascii as opposed to its normal mode of doing the opposite

-p tells it to use a plain format.

Answer from funroll on Stack Overflow
🌐
Baeldung
baeldung.com › home › scripting › convert hex to ascii characters in the linux shell
Convert Hex to ASCII Characters in the Linux Shell | Baeldung on Linux
March 18, 2024 - The ASCII value of character N is 78, which is equivalent to 4E in hexadecimal. In this example, we’re simply using the \x format specifier to represent a hex number.
Discussions

bash - How to convert hex to ASCII characters in the Linux shell? - Stack Overflow
Let's say that I have a string 5a. This is the hex representation of the ASCII letter Z. I need to find a Linux shell command which will take a hex string and output the ASCII characters that the hex More on stackoverflow.com
🌐 stackoverflow.com
Ascii/Hex convert in bash - Stack Overflow
I'm now doing it this way: [root@~]# echo Aa|hexdump -v 0000000 6141 000a 0000003 [root@~]# echo -e "\x41\x41\x41\x41" AAAA But it's not exactly behaving as I wanted,... More on stackoverflow.com
🌐 stackoverflow.com
October 31, 2012
bash - Convert ascii code to hexadecimal in UNIX shell script - Unix & Linux Stack Exchange
Unix & Linux is part of Stack Overflow’s open communities: specialist spaces where curiosity is welcome, knowledge is shared freely, and the best answers rise to the top. Find your community ... Bring the best of human thought and AI automation together at your work. Explore Stack Internal ... I'd like to convert ASCII code (like - or _ or ., etc.) to hexadecimal ... More on unix.stackexchange.com
🌐 unix.stackexchange.com
August 27, 2010
Hex to ASCII conversion - noob question
If your debugger is only writing unreadable characters, here's a BASH lang example of how you can interpret them into something readable. #!/usr/bin/env bash set -o errexit LANG=C # Read one character at a time deliminated by null characters while IFS= read -r -n 1 -d ''; do # If read's REPLY has a value, convert it to decimal, otherwise it's a null character because it was consumed as delim. if [[ $REPLY ]]; then printf -v dec '%d' "'$REPLY" else dec=0 fi # Print as decimal with some left padding printf 'dec: %-3s ' "$dec" # Print as hex printf 'hex: %02x ' "$dec" printf '\n' done Note the special handling for null characters, this is because BASH variables can't store null characters. Example of use: # Copy code into my_converter.bash chmod +x my_converter.bash debugger 2>&1 | my_converter.bash Alternatively you can pipe into something like od More on reddit.com
🌐 r/bash
8
5
December 12, 2024
🌐
LabEx
labex.io › tutorials › linux-how-to-convert-hex-to-ascii-in-bash-431151
How to convert hex to ASCII in bash | LabEx
xxd is a powerful tool for hex conversion in Linux: ## Convert hex to ASCII echo -n "48 65 6c 6c 6f" | xxd -r -p ## Output: Hello ## Convert ASCII to hex echo -n "Hello" | xxd -p ## Output: 48656c6c6f ...
🌐
TutorialsPoint
tutorialspoint.com › article › convert-hex-to-ascii-characters-in-the-linux-shell
Convert Hex to ASCII Characters in the Linux Shell
March 17, 2026 - The dc (desk calculator) command processes input in postfix notation. It can convert hex numbers directly to ASCII:
🌐
Linux Handbook
linuxhandbook.com › convert-hex-ascii
Convert Hex to ASCII Characters in Linux Command Line
July 27, 2025 - Here, command option -r is used to convert hex code to ASCII, and -p is used to print the plain text. sagar@itsfoss:~$ echo 4c696e757868616e64626f6f6b20313233 | xxd -r -p Linuxhandbook 123sagar@itsfoss:~$
🌐
UbuntuMint
ubuntumint.com › home › linux commandline tips › how to convert hex to ascii characters in linux
How to Convert Hex to ASCII Characters in Linux
July 24, 2023 - The command option -r converts the Hex characters to ASCII and command option -p prints the outcome in plain text. The final echo command produces a newline on the Linux terminal.
Find elsewhere
🌐
SysTutorials
systutorials.com › convert-hex-to-ascii-using-xxd
Converting Hex To ASCII With Xxd - SysTutorials
April 12, 2026 - The xxd -r -p combination remains the fastest and most portable way to convert hex strings to ASCII on the command line.
🌐
LinuxQuestions.org
linuxquestions.org › questions › programming-9 › [bash]-ascii-to-hex-and-hex-to-ascii-488357
[bash] ASCII to HEX and hex to ascii
What kind of command should I use to translate ascii to hex in a bash script ? (and hex back to ascii) TIA /////
🌐
Linux Handbook
linuxhandbook.com › tools › hex-ascii-converter
Free Online Hex to ASCII Converter
July 27, 2025 - Solution: Handle control characters ... Problem: Large hex strings can consume significant memory · Example: A 1MB binary file becomes a 2MB hex string...
🌐
idroot
idroot.us › home › how to convert hex to ascii characters on linux
How To Convert Hex To ASCII Characters on Linux - idroot
October 8, 2025 - For instance, the letter ‘A’ has an ASCII decimal value of 65, which translates to hexadecimal 41. The string “Linux” in hexadecimal becomes 4c696e7578, where each pair of hex digits represents one ASCII character.
🌐
Linux Today
linuxtoday.com › home › how to convert hex to ascii characters in linux
How to Convert Hex to ASCII Characters in Linux | Linux Today
May 26, 2022 - A hexadecimal numbering system is ideal for large digital systems, but not for everything. Learn to convert hex to ASCII characters in Linux here.
🌐
DEV Community
dev.to › carlyraejepsenstan › converting-hex-to-text-the-bash-way-1483
Converting Hex to Text - the Bash Way - DEV Community
March 18, 2022 - Next, we know that you can convert a hex byte into ASCII (or text) by using echo like this:
🌐
Reddit
reddit.com › r/bash › hex to ascii conversion - noob question
r/bash on Reddit: Hex to ASCII conversion - noob question
December 12, 2024 -

Hi all, freshly joined noobie here :)

I am currently working as a jr embedded software engineer, and have been struggling with data collection at runtime of the application.
I'm using a debugger that keeps sending a variable's hex value to the host pc via usb, but since this value is interpreted as ASCII, I see invalid symbols on the terminal.

As naive as it may sound, my question is: is there a way with a script to "get in between" the debugger and the terminal on the host pc to convert these hex values in their ASCII counterpart, so they are displayable "correctly"? (like, if I send 0x0123 I'd like the terminal to show "291" instead of the symbols associated with 0x01 and 0x23).
Extra question: do you have any suggestion on material I can study on to get a solid knowledge of bash scripting in general, too?

Thank you for your time and your patience, I hope I didn't sound too stupid haha.

🌐
Raspberry Pi Forums
forums.raspberrypi.com › board index › using the raspberry pi › beginners
Need help converting hex to ascii - Raspberry Pi Forums
Assuming you have a file called hex.txt and the contents looks something like below with no spaces before or after each hex code: 0x43 0x39 0x39 0x30 0x31 0x30 then the following should work: echo -e `cat hex.txt | awk '{ printf "\x" substr($0,3) }'` or: echo -e `cat hex.txt | awk '{ printf ...