June 21, 2008

'uname -a' Explained

uname is a command used to print the system information. uname -a will output all the available information this tool can provide regarding the system. For example, the output of uname -a will look something like:

$ uname -a
Linux debian 2.6.24-1-686 #1 SMP Thu May 8 02:16:39 UTC 2008 i686 GNU/Linux
$

What does is mean?

Linux is the kernel name, in this case, Linux
debian is the machine's hostname (not the distribution name, in this case the hostname just happens to have the same name as the Debian distribution)
2.6.24-1-686 is the kernel version
#1 SMP Thu May 8 02:16:39 UTC 2008 - SMP stands for symmetric multiprocessing, denoting that the CPU (central processing unit) is using two or more CPUs; what follows is the current system date
i686 is the CPU architecture
GNU/Linux is the operating system name

This information can also be retrieved using only certain options, like uname -r which will only return the kernel version, or uname -m for hardware architecture.

$ uname -m
i686
$

uname won't show the distribution version, but this can usually be obtained using other commands, specific for each distribution. For example, on Debian you would use cat /etc/debian_version, which will output something similar to:

$ cat /etc/debian_version
lenny/sid
$

Updated: Jun 21, 2008 (Created: Jun 21, 2008)

4 comments:

Heso said...

If you have the lsb_release package installed, you can run 'lsb_release -a' from the command line and you'll receive information about the installed distro.

On my machine I get this:

No LSB modules are available.
Distributor ID: Debian
Description: Debian GNU/Linux unstable (sid)
Release: unstable
Codename: sid


...which is correctly suggesting I'm using Debian unstable aka Sid.

Dan Craciun said...

$ lsb_release -a
No LSB modules are available.
Distributor ID: Debian
Description: Debian GNU/Linux testing (lenny)
Release: testing
Codename: lenny
$


Nice, tip, thanks for it. By the way, I am a little confused about the /etc/debian_version file, from what I know Lenny is currently testing, and Sid is always unstable, but why does the file say lenny/sid instead of lenny/testing?

Heso said...

I'm guessing it's because it's provided by the base-files package, and that package is probably identical between sid and lenny.

Saurabh said...

Thanks for the explanation.

"#1 SMP Thu May 8 02:16:39 UTC 2008 - SMP stands for symmetric multiprocessing, denoting that the CPU (central processing unit) is using two or more CPUs; what follows is the current system date"

Thu May 8 02:16:39 UTC 2008 - That is not your current system date. AFAIK This is the date when this particular version of kernel was compiled.