I am frequently needing to know "which system am I using". (I have trouble keeping track of which ones are which) -- i.e. is this the laptop, the Ultra 20, the whitebox, etc.
I had been using smbios a lot, but that's a bit awkward and non-portable to SPARC or systems that don't support smbios. Here's a quick script that can quickly tell me what model I'm working on. It works on SPARC and x86 alike. I have it stored in ~/bin/system -- it only works on Solaris of course. Feel free to borrow, reuse, whatever -- I hereby donate it to the public domain: #!/usr/bin/ksh
sysconf=`/usr/sbin/prtdiag | head -1` biosconf=`/usr/sbin/prtdiag | head -2 | tail -1`
sysconf=${sysconf#*:} biosconf=${biosconf#*:} sysconf=`echo ${sysconf} | /usr/bin/sed -e 's/^ //g'` biosconf=`echo ${biosconf} | /usr/bin/sed -e 's/^ //g'` if [ -z "$sysconf" ] then printf "BIOS: %s\n" "$biosconf" else printf "%s\n" "$sysconf" fi Sample outputs from a Toshiba laptop, a Sun V890, and a non-name Intel whitebox system:
TOSHIBA TECRA M9 Sun Microsystems sun4u Sun Fire V890 BIOS: Intel Corp. BX97520J.86A.2777.2007.0805.1747 08/05/2007
While the format isn't terribly parseable, its great for giving a quick assessment about what type of machine I'm on.
posted by Garrett D'Amore at 11:06 AM on Dec 14, 2009
"quick system identification"
No comments yet. -