Operating System - HP-UX
1841515 Members
3184 Online
110182 Solutions
New Discussion

Find if a binary is 32/64 bit

 
SOLVED
Go to solution
Anil C. Sedha
Trusted Contributor

Find if a binary is 32/64 bit

I have tried what, chatr, strings, file commands to find the bit version of a binary file, but have not been able to.

Is there something else to help me out.

Regards,
Anil
If you need to learn, now is the best opportunity
7 REPLIES 7
Anil C. Sedha
Trusted Contributor

Re: Find if a binary is 32/64 bit

Best points for the best answer
If you need to learn, now is the best opportunity
RAC_1
Honored Contributor

Re: Find if a binary is 32/64 bit

What is this binary file?
And what it returns for command file "your_binary_file"

Anil
There is no substitute to HARDWORK
Anil C. Sedha
Trusted Contributor

Re: Find if a binary is 32/64 bit

It is an internal application binary. I need to know what bit version has it got compiled in. what library version is it running.
If you need to learn, now is the best opportunity
Patrick Wallek
Honored Contributor
Solution

Re: Find if a binary is 32/64 bit

You should be able to figure this out based on the output of the 'file' command.

If file output is "PA RISC 1.1......" then it is definitely 32 bit.

If file output is "PA RISC 2.0......" then I believe it is still a 32-bit executable.

If file output is "ELF-64 executable object file....." then it is definitely a 64-bit executable file.

RAC_1
Honored Contributor

Re: Find if a binary is 32/64 bit

Some search work.

http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=21018

Anil
There is no substitute to HARDWORK
H.Merijn Brand (procura
Honored Contributor

Re: Find if a binary is 32/64 bit

Since od does noet show both hex and ascii, what is the output of

# perl -0 -le'@x=split//,substr(<>,0,128);while(@y=map{ord}splice@x,0,16){$y=join"",map{$_<32||$_>0x7f?sprintf"{%x}",$_:chr$_}@y;print +(map{sprintf"%02x ",$_}@y),$y;print"\n"}' your_file

?

Enjoy, Have FUN! H.Merijn [ fearing EBCDIC ]
Enjoy, Have FUN! H.Merijn
Ted Buis
Honored Contributor

Re: Find if a binary is 32/64 bit

Besides file, I think you can find this out with chatr.
Mom 6