Uname

Article on other languages:

uname (short for unix name) is a software program in Unix and Unix-like computer operating systems that prints the name, version and other details about the current machine and the operating system running on it. The uname system call and command appeared for the first time in PWB/UNIX.

Some Unix variants, such as AT&T UNIX System V Release 3.0 include the related setname program, used to change the values that uname reports.

Contents

Different uname implementations

POSIX/IEEE standard

  • Name: uname - return system name
  • Synopsis: uname [-amnrsv]
  • Description: By default, the uname utility shall write the operating system name to standard output. When options are specified, symbols representing one or more system characteristics shall be written to the standard output. The format and contents of the symbols are implementation-defined. On systems conforming to the System Interfaces volume of POSIX.1-2008, the symbols written shall be those supported by the uname() function as defined in the System Interfaces volume of POSIX.1-2008. [1]

The uname utility shall conform to the Base Definitions volume of IEEE Std 1003.1-2001, Section 12.2, Utility Syntax Guidelines. [2]

  • The following options shall be supported:
Option Description
-a Behave as though all of the options -mnrsv were specified.
-m Write the name of the hardware type on which the system is running to standard output.
-n Write the name of this node within an implementation-defined communications network.
-r Write the current release level of the operating system implementation.
-s Write the name of the implementation of the operating system.
-v Write the current version level of this release of the operating system implementation.
  • If no options are specified, the uname utility shall write the operating system name, as if the -s option had been specified.

GNU version

The GNU version of uname has been modified from the POSIX/IEEE standard to support GNU/Linux marketing [3]. For example, the -o option does not exist on non-GNU versions of uname. The GNU version has modified descriptions of options as well. [4]

Option Description
-a, --all print all information, in the following order, except omit -p and -i if unknown
-s, --kernel-name print the kernel name
-n, --nodename print the network node hostname
-r, --kernel-release print the kernel release
-v, --kernel-version print the kernel version
-m, --machine print the machine hardware name
-p, --processor print the processor type or "unknown"
-i, --hardware-platform print the hardware platform or "unknown"
-o, --operating-system print the operating system

The GNU version of uname is included in the "sh-utils" or "coreutils" packages. GNU uname itself is not available as a standalone program.

Commands on other software systems

The ver command found in software systems such as DOS, OS/2 and Microsoft Windows is similar to the uname command on UNIX-systems.

Examples of uname

The output from running uname with the -a command line argument or ver might look like the text below:

On a software system running Darwin operating system

Darwin hostname 9.2.0 Darwin Kernel Version 9.2.0: Tue Feb  5 16:13:22 PST 2008; root:xnu-1228.3.13~1/RELEASE_I386 i386

On a software system running Linux operating system

Linux hostname 2.6.24-19-server #1 SMP Sat Jul 12 00:40:01 UTC 2008 i686 GNU/Linux

A ver command on Windows 7 (beta) system running NT6.1 operating system

Microsoft Windows [Version 6.1.7000]

Table of standard uname output

The following table contains examples from various versions of uname -mnrsv on various platforms as standard output is asked if needed. These are merely meant to broadly represent common results; actual output may vary depending on hardware type, OS version, used uname (GNU or Standard) version and which software patches have been installed.

Used System OS name (-s) Name of node (-n) OS release (-r) OS version (-v) Hardware type (-m)
AIX 5.3, IBM System i, POWER5+ AIX localhost 3 5 001234564C00
Cygwin (Windows XP), Pentium 4 CYGWIN_NT-5.1 localhost 1.5.19(0.150/4/2) 2006-01-20 13:28 i686
FreeBSD 6.1, Intel FreeBSD localhost 6.1-RELEASE-p15 FreeBSD 6.1-RELEASE-p15 #1: Sun Apr 15 18:04:51 EDT 2007 i386
Gentoo Linux amd64, Intel Core 2 Duo Linux centurion 2.6.29-gentoo-r1 #2 SMP PREEMPT Sat Apr 25 15:05:17 PDT 2009 x86_64
HP-UX PA-RISC HP-UX localhost B.11.11 U 9000/800
IRIX 6.5.30, Octane2 IRIX64 localhost 6.5 07202013 IP30
Mac OS X 10.5, Intel Core Duo Darwin localhost 9.6.0 Darwin Kernel Version 9.6.0: Mon Nov 24 17:37:00 PST 2008; root:xnu-1228.9.59~1/RELEASE_I386 i386
Solaris 9, Sun Fire 280R SunOS localhost 5.9 Generic_112233-08 sun4u
openSUSE 10.3, Core2-duo 64-bit Linux localhost 2.6.22.5-31-default #1 SMP 2007/09/21 22:29:00 UTC x86_64
Debian sid, amd64, Sempron(tm) Processor 3000+ GNU/kFreeBSD localhost 7.1-1-amd64 #0 Sun Jan 11 17:59:15 CET 2009 x86_64

Web Browsers using uname

Internet browsers have the "User Agent" function, to tell the server information about the operating system, platform, and hardware on which they are running [5]. Some of this information is gathered from the uname or ver application. For example, Konqueror 4.2.1 allows the user to select to send a:

  • Add operating system name (uname -s)
    • Add operating system version (uname -r)
  • Add platform name
  • Add machine (processor) type (uname -m)

Example of information when these are selected:

Mozilla/5.0 (compatible; Konqueror/4.2; Linux 2.6.29-desktop-0.rc6.1.1mnb; X11; i686) KHTML/4.2.1 (like Gecko)

With this information, corporations collect information to calculate various things, for example: the market share of operating systems, although this kind information is not always sent by default. However, because False User Agent information can be sent to the server, this information is usually not trustworthy, even for statistics.

See also

Footnotes

External links

More about Uname: intitle phpshell uname, uname a, r57shell uname,

This article is from Wikipedia. All text is available under the terms of the GNU Free Documentation License.