如何判断Linux进程是否为64位


23

给定在x64 linux上运行的进程的pid,如何确定它运行的是32位还是64位二进制文​​件?

我可以查看二进制文件,它用完了'ps'并在其上做一个文件,但我想知道是否有一种方法可以通过查看/ proc /之类的东西来判断。

Answers:


30

您可以file用来获取该信息:

例如:

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

或从/ 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

这将告诉您它是64位还是32位。


By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.