print first n characters of any file in human readble form using hexdump

hexdump -C -n 20 filename
Usefull to determine unknown file type
Sample Output
00000000  e9 4a 35 a6 33 86 10 fc  34 e4 fc d1 45 bd bc bc  |.J5.3...4...E...|
00000010  8b d2 a1 b9 c9 1f b3 1b  49 b1 65 ab 3d 5a 90 23  |........I.e.=Z.#|
00000020  ee da 22 5d 8d dc ec 4c  1b 36 6b bb 24 da 97 39  |.."]...L.6k.$..9|
00000030  92 a1 c5 a3 71 8e 3e 68  d0 47 9c db 83 6d 15 84  |....q.>h.G...m..|
00000040  49 96 c2 92 bb 7a ce eb  9e 93 22 65 70 fc 71 4f  |I....z...."ep.qO|

2012-03-05 15:57:41

What do you think?

Any thoughts on this command? Does it work on your machine? Can you do the same thing with only 14 characters?

You must be signed in to comment.

What's this? is the place to record those command-line gems that you return to again and again. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.

Share Your Commands

Stay in the loop…

Follow the Tweets.

Every new command is wrapped in a tweet and posted to Twitter. Following the stream is a great way of staying abreast of the latest commands. For the more discerning, there are Twitter accounts for commands that get a minimum of 3 and 10 votes - that way only the great commands get tweeted.


Subscribe to the feeds.

Use your favourite RSS aggregator to stay in touch with the latest commands. There are feeds mirroring the 3 Twitter streams as well as for virtually every other subset (users, tags, functions,…):

Subscribe to the feed for: