How to find out the type of car?

I would like to know the type of machine architecture of a large number of machines. I have a host name for each machine. The machines have Debian 4 linux, SunOS 9, SunOS 10, or Apple Darwin. All are unix-like, but with minor differences.

I would like to know: - architecture (x86, x86_64, ia64, sparc, powerpc ...) - processor type (intel pentium, pentium pro, pentium II, sparc, powerpc, itanium, athlon, core 2 duo, cytrix, etc. d.) - number of processors

Beware, I want a “type” of car. The stupid approach using "uname" does not work on Sun, and it also returns things like "i686" when the machine is actually "x86_64", but the operating system is 32 bits. / proc / cpuinfo does not work, and everything becomes even more complicated, because on some machines there is no C compiler (I am sure that all of them have sh, possibly python or perl, dunno).

Thanks in advance!:)

+5
source share
6 answers

arch ; uname -a

arch is the standard way to get the name of a processor instruction set. uname -a gets a ton of OS information. uname withouth a gets the name of the OS.

+16
source

Perl:

perl -MConfig -e 'print "$Config{myarchname}\n";'

, Mac OS X Leopard Perl 5.10.0 "i386-darwin". , Perl - , , C, . C Perl:

perl -MConfig -e 'print join("\n", split(/ /, $Config{cppsymbols})), "\n";'

__LITTLE_ENDIAN__ __MACH__ Mach-O __i386__ ( , Leopard), , __GNUC__ __STDC__. , , Perl . , , , .

+4

- . URL http://reductivelabs.com/projects/facter/.

- Ruby . , . Facter , , IP-, MAC- SSH-.
+2

/proc/cpuinfo ?

, , , Linux. , CPU .

, , , , /proc/cpuinfo, .

:

/proc/cpuinfo . : , uname, .

+2

, .

arch HP-UX Itanium, /proc, .

, ( ), O/S, . 4 Unix (Linux x86_64, Solaris Sparc, AIX/Power, HP-UX Itanium). , , , .

, Solaris , , , , , , x86_64 , , Sparc.

, Sparc , , 32 64- :

# isalist -v
sparcv9+vis2 sparcv9+vis sparcv9 sparcv8plus+vis2 sparcv8plus+vis sparcv8plus sparcv8 sparcv8-fsmuld sparcv7 sparc

'sparcv9', 64 , sparcv8 - 32

+1

uname -a , , .

:

uname -i

uname -m

0

All Articles