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 - Alternatively, we can use the dc command to convert a character from hex to ASCII. The dc stands for Desk Calculator.
๐ŸŒ
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:~$
Discussions

Conversion hex string into ascii in bash command line - Stack Overflow
I have a lot of this kind of string and I want to find a command to convert it in ascii, I tried with echo -e and od, but it did not work. 0xA7.0x9B.0x46.0x8D.0x1E.0x52.0xA7.0x9B.0x7B.0x31.0xD2 More on stackoverflow.com
๐ŸŒ stackoverflow.com
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
convert hex to ascii text
Is there a command to convert hex characters into their respective ascii values? More on unix.com
๐ŸŒ unix.com
5
0
October 19, 2017
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
๐ŸŒ
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 sed command transforms the hex string using regular expressions, converting pairs of hex digits into escape sequences:
๐ŸŒ
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 final echo command produces a newline on the Linux terminal. ... If you wish to convert the Hex characters to ASCII characters from a file, use the cat command and pipe the file to xxd command.
๐ŸŒ
SysTutorials
systutorials.com โ€บ convert-hex-to-ascii-using-xxd
Converting Hex To ASCII With Xxd - SysTutorials
April 12, 2026 - # Without -p, long input may be split across lines $ xxd -r file.hex # May fail with malformed input # With -p, whitespace is ignored $ xxd -r -p file.hex # Works correctly ยท For simple one-liners, printf with bash parameter expansion works for small inputs: ... For larger data or programmatic ...
Find elsewhere
๐ŸŒ
LabEx
labex.io โ€บ tutorials โ€บ linux-how-to-convert-hex-to-ascii-in-bash-431151
How to convert hex to ASCII in bash | LabEx
... At LabEx, we understand the importance of mastering these fundamental encoding techniques for robust Linux system programming. xxd is a powerful tool for hex conversion in Linux: ## Convert hex to ASCII echo -n "48 65 6c 6c 6f" | xxd -r ...
๐ŸŒ
Linux Handbook
linuxhandbook.com โ€บ tools โ€บ hex-ascii-converter
Free Online Hex to ASCII Converter
July 27, 2025 - You don't have to rely on online hex to ascii converters. Linux has multiple commands to handle it right there in the terminal.
๐ŸŒ
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 ...
๐ŸŒ
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.

๐ŸŒ
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 - First, we know that hexadecimal bytes are always 2 characters - you can verify this by using man ascii in your terminal and checking out the tables it shows. Next, we know that you can convert a hex byte into ASCII (or text) by using echo like this:
๐ŸŒ
Unix Community
community.unix.com โ€บ shell programming and scripting
Convert Hex to Ascii in a Ascii file - Shell Programming and Scripting - Unix Linux Community
December 19, 2016 - Hi All, I have an ascii file in which few columns are having hex values which i need to convert into ascii. Kindly suggest me what command can be used in unix shell scripting? Thanks in Advance
๐ŸŒ
Reddit
reddit.com โ€บ r/linux4noobs โ€บ how do you "convert" ascii "hex" data into actual hex, and how can you insert it into a binary file at a specific offset?
r/linux4noobs on Reddit: How do you "convert" ascii "hex" data into actual hex, and how can you insert it into a binary file at a specific offset?
June 7, 2013 -

Sorry if I'm a bit off with my terminology.

I have a binary file, a ROM for a gameboy game. Let's assume that between the offsets of AC000 and AF000 is a bunch of text encoded in hex.

Let's say I have a basic text file with hex data (or binary data) written in ascii. That is, the actual text of the file is "48 65 6c 6c 6f 20 57 6f 72 6c 64 21"(formatted in whatever the best way to format it to solve my problem would be), but the actual hex of the file is "34 38 20 36 35 20 36 63 20 36 63 20 36 66 20 32 30 20 35 37 20 36 66 20 37 32 20 36 63 20 36 34 20 32 31" How would I make an actual hex file with the proper hex data?

That's the first part of my question. The second part is how do you insert that data into another hex file at a certain offset over writing the data already there? xiv, which is a windows text editor, has the functionality of being able to import another file, but it does not overwrite. Which is okay I guess but inconvenient because I have to delete all the data it moves. Additionally, I'd like to be able to do this without using wine.

Because I feel like I am being confusing, here is a picture of what I want to do: http://i.imgur.com/pCyOLEx.png

Thank you greatly for any help.

EDIT: I can't edit the data manually because it is a LOT of hex data. Instead, I am converting text to the proper hex values, and I want to IMPORT the file directly, because that is much much quicker than typing in the individual values for each letter.

EDIT: After a lot of hair-pulling, I think I've solved this.

To fix the first problem (the turning ascii hex into actual hex), I did

xxd -p -r ascii.file patch.file

The -p is VERY important.

Then, once I have patch.file, I do

dd if=patch.file of=source.file seek=56000 obs=1 conv=notrunc count=2000 bs=1

Where "seek" is the offset I want the imported data to start, bs is set to 1 to indicate I want it to count by one byte, and count is how many bytes are in the patch.file

Thanks to everyone who helped.

๐ŸŒ
Unix Community
community.unix.com โ€บ shell programming and scripting
Converting hex to ascii/decimal - Shell Programming and Scripting - Unix Linux Community
March 31, 2011 - I am writing a bash script to do some parsing on a log and I am running into a problem when it comes to converting only certain sections of the file from hex to ascii or hex to decimal. Data Example: The hex values afโ€ฆ