Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [hexdump]

The tag has no usage guidance.

34
votes
6answers
24k views

How to dump a binary file as a C/C++ string literal?

I have a binary file I would like to include in my C source code (temporarily, for testing purposes) so I would like to obtain the file contents as a C string, something like this: \x01\x02\x03\x04 ...
28
votes
5answers
14k views

Is there an alternative to sed that supports unicode?

For example: sed 's/\u0091//g' file1 Right now, I have to do hexdump to get hex number and put into sed as follows: $ echo -ne '\u9991' | hexdump -C 00000000 e9 a6 91 ...
21
votes
2answers
18k views

Does hexdump respect the endianness of its system?

On my machine I get the following output when I run these commands: $ echo foos > myfile $ hexdump myfile 6f66 736f 000a The output from hexdump is little-endian. Does this mean that my machine ...
11
votes
2answers
28k views

How to interpret an octal or hex dump of a binary file?

The binary file has strings and some numbers, If I do od -c filename or strings filename, I can see the strings properly. But, what about numbers? They are in some weird format. The text after doing ...
7
votes
3answers
2k views

Achieving hexdump-like format, that includes binary strings, on the command line?

I really like hexdump, especially because you can define a custom format; say: $ echo -e '\x00\x01\x02\x03' | hexdump -v -e '1/1 "%_ad: "' -e '4/1 "%02X "' -e '1/1 " : "' -e '4/1 "%_p"' -e '1/1 "\n"' ...
6
votes
3answers
9k views

Converting from binary to hex and back

Given a binary file, how do you convert it to a hex string and back, using only standard tools like sed and cut, on a minimal system with busybox installed? These tools are not available: perl ...
6
votes
1answer
762 views

What does `*` mean using hexdump -C?

I've been doing an exersice in attempt to understanding some of what's going on under the hood of a program. I wrote a small C program, and compiled it on i386 Linux (Ubuntu 12.04) using gcc. I then ...
6
votes
3answers
2k views

Hexdump of a string starting at new lines?

Say I have a multi-line strings, but the entries on it are short; if I try to hexdump, then I get something like this: echo "something is being written here" | hexdump -C #00000000 73 6f 6d 65 74 ...
5
votes
3answers
1k views

Why do ls and hexdump disagree about my file size?

I have a file I created (in vim), for testing purposes (testing UTF-8 output in an SSH client). Odd things, however, are happening to this file. I wondered what bytes were in the file, so I used ...
5
votes
2answers
109 views

Why does hexdump try to read through EOF?

When run from a terminal, hexdump does not react to a single ^D at the beginning of the line, as cat, od, bc, etc. do, unless there was no input yet: prompt% hexdump -C <control-D> prompt% ...
5
votes
1answer
996 views

How to make hexdump not wait for 16 characters from stdin to display their hex values?

If I opened hexdump without any argument in the terminal: hexdump When I type something in the terminal and press Enter, hexdump will display the hex values for whatever characters I type. But ...
4
votes
1answer
2k views

Why do I get different output from hexdump compared to xxd?

Why does hexdump seem to miss out parts of the file, while xxd does not? The file is 32 bytes. So xxd output is correct. $ xxd test.bin 0000000: 8888 8888 8888 8888 8888 8888 8888 8888 .................
4
votes
3answers
489 views

Why can't I edit links and directories directly?

There are programs such as hexedit that allow one to edit each bit of a file, and as I keep hearing that in Unix "everything is a file", I tried to edit some directory, expecting bytes referring to ...
3
votes
1answer
1k views

Hexdump of a file - what do these numbers mean?

I created a simple 1.txt file : echo "hello" >> 1.txt Then I dump it : hexdump 1.txt And terminal outputs: 0000000 68 65 6c 6c 6f 0a 0000006 What does 0000000 ...
3
votes
2answers
2k views

Get hex-only output from objdump

Say for example I've got this C function: void f(int *x, int *y) { (*x) = (*x) * (*y); } When saved to f.c, compiling with gcc -c f.c produces f.o. objdump -d f.o gives this: f.o: file ...
3
votes
1answer
1k views

Print one byte signed number with hexdump

I want to read /dev/input/mice with hexdump. Format is described at here at StackOverflow. What I need is to read one byte (flags), print it in hex format, then read two bytes (x and y move offset) ...
3
votes
1answer
109 views

Can hexdump display its text translations in alternate encodings?

Hexdump's canonical format displays an ASCII translation of whatever it's looking at in the right column. I have a binary file, containing non-ASCII strings, for which I know some (not all) of the ...
3
votes
0answers
736 views

Procedure to figuring out U-Boot environment location from binary/hex dump

TL;DR: I have a u-boot (version 1.6.1) enabled board, I have dumped the partition that contains the environment variables to a binary file using dd and now am stumped at finding out how to translate ...
2
votes
1answer
20k views

How to convert hexdump to text?

I know that xxd is used to convert texts to hexdump but I want to do the opposite: convert an hex dump to text! Is there some command that I can use? Thanks for the help!
2
votes
1answer
1k views

Strange ascii from hexdump of text file

I saw this question Why does Ctrl-D (EOF) exit the shell? and wanted to try the example on the second answer. So i've created a file and used hexdump: federico@home ~ $ cat > test.txt prova ^C ...
2
votes
3answers
487 views

Portable one-byte per line hex dump

Suppose we want a minimalist one-byte per line ASCII hex dump. Under Linux using GNU od, this works: echo foo | od -An -tx1 -w1 -v Output: 66 6f 6f 0a But that won't work with BSD derivatives,...
2
votes
1answer
638 views

Why does xxd not show the byte order mark?

I have a Java class which the compiler refuses to compile due to \ufeff at the start of the file. I can view the fact that the BOM is present by vim -b file.java, but neither xxd nor hexdump show the ...
2
votes
0answers
258 views

Why “hexdump” displays a new empty line?

I have noticed a strange behavior when hexdump displays the hex values of a file, I have executed the following command: hexdump -C 1.txt And I got the following result: Notice how hexdump ...
1
vote
1answer
889 views

What is the meaning of Star symbol * in Hex data?

I see sometimes star symbol (*) in the hex editor, like ... 00001d0 0000 0000 0000 0000 0000 0000 0000 0000 * 00001f0 0000 0000 0000 0000 0008 0000 0000 0000 ... It is probably some sort of ...
1
vote
1answer
2k views

hexdump: How to suppress offset column in hex mode

I wanted to get 16 bytes from a binary file, starting from 5th byte, no separation of bytes or words by spaces. hexdump will do what I want, just the offset column is disturbing the output: $ ...
1
vote
1answer
23 views

Get absolute memory addresses instead of relative offsets from hexdump

I'm trying to get a better understanding of memory addresses. I've just begun examining binaries with hexdump. Ex output: 0000000 cf fa ed fe 07 00 00 01 03 00 00 80 02 00 00 00 0000010 0e 00 00 00 ...
1
vote
1answer
759 views

Hexdump format syntax - color

I'm trying to display a hexdump of a file and highlight carriage returns in red. I'm having a really hard time understanding the format of the formats option (-e). Is it something like: hexdump -e "...
1
vote
1answer
133 views

How to include a backslash \ in the hexdump output format string?

What I want to see: $ printf "\U1F600\n"|hexdump -v -e '1/1 " %03o"'|tr ' ' '\\' \360\237\230\200\012 What I tried: $ printf "\U1F600\n"|hexdump -v -e '1/1 "\\%03o"' hexdump: bad conversion ...
1
vote
1answer
63 views

Grep output from USBPcap

I hope cygwin questions fits here. If I try: USBPcapCMD.exe -d \\.\USBPcap4 -o - | hexdump -C it gives me the expected result. But if I try to grep that result I get nothing: USBPcapCMD.exe -d \\....
1
vote
1answer
1k views

hexedit: change number of columns (bytes per line)

I am using hexedit to show/edit disk MBR (512 Bytes, copied with dd). When I open the file, hexedit displays the file as 9 columns, 4 bytes per column (36 bytes per line). That is very unfortunate. I ...
1
vote
0answers
147 views

Is there a utility that allows to create structured data from tcpdump hexdumps?

Sometimes I have to use tcpdump to troubleshoot problems with networking protocols that tcpdump does not know how to parse. Is there a utility that could read tcpdump packets in hex dump format and ...
1
vote
1answer
387 views

Hexdump binary file while honoring separators

I have a binary file where records are separated by newlines. hexdump just dumps everything with a fixed column width. Is there a tool to hexdump this file, while honoring the newline separator? (Any ...
0
votes
1answer
1k views

Commands for data manipulation of binary to octave/hex formats?

I need to convert binary data to hex/octave/any suitable format and back to binary when I am splitting one big 1GB file into files containing 777 events each which are not of the same size such that ...
0
votes
2answers
422 views

How to get Hexdump output in same format as hexedit?

I'm trying to get the output of my hexdump command to look similar to hexedit default. I've been playing with the format strings using -e, but since there are not very good documentation, that ...
0
votes
0answers
27 views

New CF memory card not empty (random pattern instead of zeros)

I recently bought a 16 GB "Sandisk Ultra" Compact Flash card for my camera. I always do some testing on new storage devices before starting normal use: first some scanning, then maybe a copy of the ...
0
votes
0answers
46 views

Do my LUKS partition damaged?

Some say that my LUKS parition may have been damaged due to some mistakes, but I'm not very sure. hexdump -C /dev/sda7 | grep LUKS 1cca2cc80 7f 66 4c 55 4b 53 bd 14 ff c3 3e 2c 52 f0 7c 3a |....
0
votes
0answers
14 views

How to debug a font binary from the Terminal on Mac

I have created a demo font which I haven't been able to get working yet, running into this Browser error when I try to load it in the browser: OTS parsing error: incorrect entrySelector for table ...
0
votes
0answers
21 views

Use objdump to show data as floating point

I have a ELF executable a.out that uses some floating point constants. After some investigation I found the address of these constants and then I do, $ objdump -s a.out | grep 4a9940 which gives me ...
0
votes
1answer
2k views

Convert serialized Java object to human readable

I have object of class class X { private DateTime dt; "constructor, set/get" } I have one instance of this object serialized in file.bin. I want to show content of `file.bin on the Linux ...
0
votes
1answer
744 views

stream a certificate to stdout to download it in php

Related Questions : when downloading certficate binary data , result is invalid certificate Download binary stream data from browser using PHP with web service “ downloaded file is corrupted ” ...