Getting System Information with uname
Information about your Unix system might come in handy if you're planning to try some new software or need to figure out system idiosyncrasies. Some systems tell you this information when you log in. Sometimes, however, especially if you're using an ISP, you may not have been told any particulars about the Unix system. You can easily find out what kind of Unix system you're using with uname, as shown in Code Listings 7.1 and 7.2.
Code Listing 7.1. Variants on the uname command provide all kinds of interesting or useful information about the system.
ejray@home $ ssh frizz Last login: Wed Oct 10 09:59:09 from frazz Sun Microsystems Inc. SunOS 5.9 Generic May 2002 ejray@frizz $ uname SunOS ejray@frizz $ uname -sr SunOS 5.9 ejray@frizz $ uname -a SunOS frizz 5.9 Generic_112233-01 sun4u sparc SUNW,Ultra-5_10
To find out about the system using uname:
To begin, type uname to find out what kind of a system you're on. The Unix system in Code Listings 7.1 and 7.2 is Solaris (aka, SunOS). Other common systems (not an exhaustive list, by any means) are Linux, AIX, BSD, and HP/UX.
Add the -sr flags to the command, yielding uname -sr, to find out both the operating system type and the release level. This is useful to find out whether specific software is compatible with the operating system.
For the whole nine yards, use uname -a to print all information, including the operating system type, host name, version, and hardware. The specifics you get here will vary a bit from system to system.
Code Listing 7.2. On a different system, the same commands provide slightly different details, although the basic information remains the same.
ejray@frazz $ uname Linux ejray@frazz $ uname -sr Linux 2.4.19-16mdk ejray@frazz $ uname -a Linux frazz.raycomm.com2.4.19-16mdk #1 Fri Sep 20 18:15:05 CEST 2002 i686 unknown unknown GNU/Linux ejray@frazz $