Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Given the pid of a process that's running on a x64 linux, how do I tell if it's running a 32 or 64 bit binary?

I can look at the binary it's running out of 'ps' and do a file on that but I was wondering if there's a way to tell by looking at /proc/ or something like that.

share|improve this question

2 Answers 2

You can use file to get that information:

For example:

chris@obsidian:~$ file /usr/bin/perl
/usr/bin/perl: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), for GNU/Linux 2.6.8, dynamically linked (uses shared libs), stripped

or read from /proc/

chris@obsidian:~$ file -L /proc/[PID]/exe
/proc/[PID]/exe: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), for GNU/Linux 2.6.8, dynamically linked (uses shared libs), stripped

This will tell you if it is 64 or 32-bit.

share|improve this answer

Starting from the PID you can:

file -L /proc/PID/exe
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.