Operating System - HP-UX
1822728 Members
3745 Online
109644 Solutions
New Discussion юеВ

How to view Binary file in HPUX

 
SOLVED
Go to solution
Vaibhav_6
Advisor

How to view Binary file in HPUX

Hi

Can anyone answer this on the forum.I jus dont happen to remeber it.

Thx
Vaibhav
9 REPLIES 9
A. Clay Stephenson
Acclaimed Contributor

Re: How to view Binary file in HPUX

Use the od command. Man od for details. If you like, you can download and install hexedit from any HP-UX Porting Centre. It's a nice interface and you can edit the file as well as view it.
If it ain't broke, I can fix that.
Jeff Schussele
Honored Contributor
Solution

Re: How to view Binary file in HPUX

Hi,

You can also use the strings commands to view text within the binary, i.e. error codes, comments and such.

Rgds,
Jeff
PERSEVERANCE -- Remember, whatever does not kill you only makes you stronger!
Mel Burslan
Honored Contributor

Re: How to view Binary file in HPUX

strings |more

is my way of doing it.
________________________________
UNIX because I majored in cryptology...
Sandman!
Honored Contributor

Re: How to view Binary file in HPUX

Use strings mostly...though od is also helpful in certain situations.

thx
Raj D.
Honored Contributor

Re: How to view Binary file in HPUX

Hi Vaibhav ,

You can use strings command , to view an object , data or other binary files.

ex: # strings /etc/lvmtab

You can use od also , but its complex one ,

To display a file in octal, a page at a time, :

# od a.out | pg
-------------------

The xd command also allows you to dump a binary to text,
----------------------------


Cheers ,

RajD.
---
" If u think u can , If u think u cannot , - You are always Right . "
Bill Hassell
Honored Contributor

Re: How to view Binary file in HPUX

Probably the most useful command is xd (which is really od in disguise). od defaults to octal output which is almost useless today, while xd shows numbers in hex. But xd is really od -x and vice versa, xd -o is the same as od. This is easily explained because it is a single program with a link.

The most useful option set is: xd -xc which shows both the hex numbers as well as the equivalent ASCII displayable characters. Consider these 3 listings of a file with ABC123xyz:

# od xx
0000000 040502 041461 031063 074171 075012
0000012

# xd xx
0000000 4142 4331 3233 7879 7a0a
000000a

# xd -xc xx
0000000 4142 4331 3233 7879 7a0a
A B C 1 2 3 x y z \n
000000a


Bill Hassell, sysadmin
Rodney Hills
Honored Contributor

Re: How to view Binary file in HPUX

Don't forget "cat" and -v option.

cat -v
HTH

-- Rod Hills
There be dragons...
Mahesh Kumar Malik
Honored Contributor

Re: How to view Binary file in HPUX

Hi Vaibhav

#strings will enable you to view binary file

Regards
Mahesh
Muthukumar_5
Honored Contributor

Re: How to view Binary file in HPUX

You can use odump or elfdump based upon binary file type.

Detect file type as,

file

If it is not elf format then,

# odump -all ./

If it is,

# elfdump -cLrs ./

You can also use strings or nm or chatr.

hth.
Easy to suggest when don't know about the problem!