Linux xxd Hex Dumper Utility: How to Use

Linux xxd Hex Dumper Utility: How to Use

If you need to print the contents of any file in hexadecimal format, use xxd Hex Dumper

Although most people won’t use bits and bytes every day, there are still ways to explore the files in your Linux system at this level. One such utility is xxd, which can be used to dump hex values.

Here are the steps to use the xxd Hex Dumper utility to print files in hexadecimal format.

What is a Hex Dumper?

A hex dumper, as mentioned, outputs the contents of a file or “dumps it” into hexadecimal numbers. Hexadecimal numbers are 16 characters long, with A-F representing numbers 10-15.

Hexadecimal numbers can be used to represent binary. This is because four bits or half a byte can be represented in one hexadecimal number. It’s easier to write binary numbers than long strings of ones, zeros, and more.

You may have used the hexadecimal formatting when choosing color palettes for your designs . This chart shows web-safe colors. These colors have hex values that start with a POUND ( #) character.

RELATED: How to Find the Hex Value of Any Color on Your Screen

Use xxd to dump your files in Hex format

Although xxd is not part of any standard Linux system, it does make up a component of Vim’s editor. Vim is widely installed on many Linux platforms, so it may as well be the default. Look for it in the package manager of your distro if it isn’t installed.

To invoke xxd, type:

xxd [FILE]

xxd will by default print the line number, binary contents in Hexadecimal and any human-readable strings in columnar format. If you have an ASCII table, xxd can be used to examine text files. However, it can also be very useful.

Below is an example from a PNG File that was a screenshot taken from another article.

You can also find strings in binary files using a text editor. It will usually be the file type being examined. However, other messages might be included. While most of the text in a binary file will be gibberish, there might be information at the file’s beginning such as the file type and the program that created it.

Files can be examined with xxd

You can search all types of files with xxd or other hex dump utilities. You might be surprised at the things you find.

You can also use a Hex Editor to make modifications to the file if you are brave enough. A Linux system also has many text editors that are free.


Leave a Reply

Your email address will not be published.