Search code examples
linuxmacosshellscriptingsolaris

How to discover the machine type?


I would like to discover the machine architecture type of a big number of machines. I have the hostname of 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...) - number of processors

Beware, I want the "type" of the machine. The stupid approach using 'uname' does not work on Sun and it also returns things like 'i686' when the machine is in fact 'x86_64' but the operating system is 32 bits. /proc/cpuinfo doesn't work neither, and things get even more complicated because some machines dont have a C compiler installed (I'm sure they all have sh, perhaps python or perl, dunno).

Thanks in advance!! :)


Solution

  • arch ; uname -a

    arch is the standard way to get the name of the CPU instruction set. uname -a gets a bunch of stuff about the OS. uname withouth the a gets the OS name.

    However programmatically speaking, the equivalent to arch is uname -m.