LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   find out if it is32 or 64 bit process (https://www.linuxquestions.org/questions/linux-software-2/find-out-if-it-is32-or-64-bit-process-808220/)

brgsousa 05-16-2010 07:01 PM

find out if it is32 or 64 bit process
 
Hi everyone,
Using Debian Squeeze amd64.
How can I find out, from running process, which ones are 32 bit, and which ones are 64 bits?

johnsfine 05-16-2010 08:37 PM

I'm not sure what exceptional cases might exist where this doesn't work. I also don't know if I'm ignoring some easier or more reliable method (I know several harder methods). But what I have is:

Code:

file -L /proc/pid/exe
replacing pid with the pid of the process that you want the info on.

brgsousa 05-16-2010 11:50 PM

Thanks! It worked fine on Debian.
It should be easier, like a column in 'top' :P

xakup 08-11-2010 03:20 AM

Hi all! Is there any other way to get it programmatically, like a special flag somewhere in /proc/<pid>/, etc.??

edit:
OK, I have ended up parsing process executable (/proc/<pid>/exe or /proc/<pid>/cmdline)
the 5th byte in ELF header can be 1 if compiled as 32 bit or 2 for 64


All times are GMT -5. The time now is 02:41 PM.