Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

in order to see the header of file (wmv,mp3, binary[pe/elf/machos], avi, etc....) which command line in unix could perform this ?

looking forward for some answers :D

share|improve this question

migrated from Jan 25 '11 at 8:51

This question came from our site for professional and enthusiast programmers.

Not programming. Did you even try the file command? – leppie Jan 25 '11 at 5:12
do you want to see the first few bytes in hex? xxd is your friend. – akira Jan 25 '11 at 9:44

The question is a bit wide in scope, so the suggestion is to approach in steps.

  1. Use file command to get first level information: File (Unix).
  2. Then subsequently use FFMPG for audio video headers.
  3. And dump for object files.

See also: ffmpeg command line options

share|improve this answer

I generally use od -bc {filename} | head to look at the header of a binary file. view works too, but I find that it is generally better to see the output directly on the terminal.

share|improve this answer

head will show the first few lines of code in a file.

A 'good' way of getting it into hex, pull the file into gvim and in the 'menu' (if you don't like typing abstract commands) there is an option to put the data through xxd getting it into hex. This is a good universal place to open a file like this as you'll be able to copy/paste plus have all of the wonderful tools of vim at your fingertips!

share|improve this answer

Identify is also useful for images:

Identify describes the format and characteristics of one or more image files. It will also report if an image is incomplete or corrupt. The information displayed includes the scene number, the file name, the width and height of the image, whether the image is colormapped or not, the number of colors in the image, the number of bytes in the image, the format of the image (JPEG, PNM, etc.), and finally the number of seconds it took to read and process the image.

share|improve this answer

Another program is bvi if you are familiar with vi.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .