Monday, May 6, 2024
4
rated 0 times [  4] [ 0]  / answers: 1 / hits: 3991  / 3 Years ago, thu, june 17, 2021, 6:19:06

I ran hexdump command without parameter and my ubuntu machine froze... What did I do? What does this command do without parameter?



And what is it useful for?


More From » command-line

 Answers
7

This is from man hexdump:




The hexdump utility is a filter which displays the specified files, or the standard input, if no files are specified, in a user specified format.




In short, it transforms text from one format to another. Traditionally, hexdump is mostly used for debugging, especially programs that are using low-level libraries.



But now with unicode, I sometimes use it to get different values of characters or to transform lines or files.



Because it is a filter, you send text into it. An easy way to do this is with the pipe operator (|).



It outputs the text displayed as either ASCII, decimal, hex, or octal. You use format specifiers to determine the output. These are command options you put after the hexdump.



If you want to see the results on the command line you need to start off with echo.



So it's echo text-to-transform | hexdump options optional-format-specifiers



An example from the man page is:



echo hello | hexdump -v -e '/1 "%02X
"'


which outputs the hex value of each letter.



This example may not seem useful but remember it's possible to recode entire files or dump contents of memory in a human readable form.



If you don't send input to hexdump, it keeps waiting and appears to do nothing. This is what would happen if you ran hexdump by itself. When you say it froze, did more than that happen?


[#33015] Thursday, June 17, 2021, 3 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
velelf

Total Points: 395
Total Questions: 115
Total Answers: 107

Location: Sudan
Member since Mon, Jun 1, 2020
4 Years ago
;