![Forrest logo](/images/logo.png)
hexdump
Hexdump is a command line tool used to display the contents of a file or input in hexadecimal and ASCII formats. It allows users to examine the binary representation of files, which is especially useful for analyzing data structures or identifying patterns in binary files.
The basic syntax for using hexdump is "hexdump [options] [file]", where the options modify the output format and behavior of the tool. Some commonly used options include -C (show ASCII alongside hexadecimal), -b (display bytes as octal), and -s (skip a specified number of bytes).
Hexdump displays each line in a compact format, showing the hexadecimal representation of the data followed by a corresponding ASCII representation. Non-printable characters are represented as dots in the ASCII column.
By default, hexdump displays the entire input file or stream. However, users can also specify an offset and length to limit the output to a specific portion of the file. This is helpful when working with large files or when only interested in examining a specific section.
Hexdump is often used in conjunction with other tools such as grep or awk to perform targeted searches or manipulate the output. For example, you can grep for specific patterns in hexdump output to find occurrences of certain byte sequences.
In addition to files, hexdump can also read input from standard input, making it versatile for various input sources.
Hexdump is found on Unix-like operating systems, including Linux and macOS, and is part of the coreutils package. It is a powerful tool for low-level analysis and is widely used by developers, system administrators, and security professionals.
List of commands for hexdump:
-
hexdump:tldr:6568e hexdump: Display the input offset in hexadecimal and its ASCII representation in two columns.$ hexdump -C ${filename}try on your machineexplain this command
-
hexdump:tldr:76759 hexdump: Don't replace duplicate lines with '*'.$ hexdump --no-squeezing ${filename}try on your machineexplain this command
-
hexdump:tldr:dd142 hexdump: Print the hexadecimal representation of a file, replacing duplicate lines by '*'.$ hexdump ${filename}try on your machineexplain this command
-
hexdump:tldr:dd557 hexdump: Display the hexadecimal representation of a file, but interpret only n bytes of the input.$ hexdump -C -n${number_of_bytes} ${filename}try on your machineexplain this command