Generating hexadecimal dumps
To create a hexadecimal dump of a file, you can use the following command:
xxd [file path]
The binary output on the left side represents a hexadecimal memory address or offset, which indicates the position of each line’s data in memory or a binary file, then there are two columns:
- The leftThe right column contains the hexadecimal representation of the binary data.
- The right, column shows the ASCII representation.
Here we can see, that the hexadecimal representation for ‘H’ is 48, for ‘e’ it is 65, the and so on.
Note: Hexadecimal ‘0a‘ is a line feed character and is marking the end of the text file.
Storing hexadecimal dump in a file
We can store the generated hexadecimal dump using the redirection operator ‘>’, type the following command:
xxd [file path] > [output file path]
Here, the hexadecimal dump from standard output is stored in a file named hexdump.txt using the the redirection operator.
xxd Command in Linux
xxd is a command-line tool that is primarily used for creating and analyzing hexadecimal dumps from files. It can also be used to reverse the process and convert a hexadecimal dump back into binary form. In this article, let’s uncover the practical applications of the “xxd” command in the Linux ecosystem.
xxd Command in Linux
- What is a ‘hexadecimal dump’?
- Installing xxd on Linux
- Using xxd command:
- Generating hexadecimal dumps
- Converting hexadecimal dump to the original file
- Formatting output of xxd
- Different dump output styles
- Embedding Binary Data in C/C++ Code (xxd -i)