uname command is one of the most useful commands when it comes to gathering basic information about your Unix/Linux system. You can use it to find out the hostname of the system you’re on, the hardware architectures supported by the currently used kernel and the exact release of your system.
Basic uname usage
uname -n
This command shows you the node (host) name of your system:
bash-3.00$ uname -n
samplehost
uname -i
If you’re interested in confirming the hardware platform of your system, this is the command to use.
For Linux, it will return i386 for 32-bit processors or x86_64 for 64-bit ones. For Solaris, it will confirm the actual server type used:
bash-3.00$ uname -i
SUNW,Sun-Fire-V490
Release and version of the Unix kernel
To find out the release and version of your Unix kernel, you need to use uname -r and uname -v.
uname -r
This allows you to confirm the release of Unix kernel used in your OS.
On Linux, it looks like this:
bash-3.00$ uname -r
2.6.18-8.el5
On Solaris, it’s much shorter and more meaningful, at it gives you the version of Solaris, and not the kernel (this example is for Solaris 10):
bash-3.00$ uname -r
5.10
For the version of Unix kernel, use uname -v:
bash-3.1$ uname -v
#1 SMP Fri Jan 26 14:15:14 EST 2007
Typical Solaris output:
bash-3.00$ uname -v
Generic_127111-01
Common uname usage
uname -a
Most usually, you simply use uname to output everything it knows about your system.
On Linux it looks like this:
bash-3.00$ uname -a
Linux samplehost 2.6.18-8.el5 #1 SMP Fri Jan 26 14:15:14 EST 2007 x86_64 x86_64 x86_64 GNU/Linux
On Solaris, uname -a output should be similar to this:
bash-3.00$ uname -a
SunOS samplehost 5.10 Generic_127111-01 sun4u sparc SUNW,Sun-Fire-V490
I'm a principal consultant with Tech Stack Solutions. I help with cloud architectrure, AWS deployments and automated management of Unix/Linux infrastructure. Get in touch!