Previous Table of Contents Next

Module 148
uname (SV)


The external uname command displays the name, node, version, release, and hardware type of the current UNIX operating system. By default only the system's name is displayed. The following section on Options describes how to display other information.


Following is the general format of the uname command.

     uname [ -amnprsv ]
     uname [ -S system_name ]


The following list describes the options that may be used to control how uname functions.

-a Display all possible information. Invokes all other options except -S.
-m Display the name of the hardware. (i.e. 68020, 386i, 3B20)
-n Display the network nodename. The nodename is the name the system is known by on a network.
-p Display processor type (i.e. i386, 68020, 68030, SPARC, R3000).
-r Display the release number of the operating system.
-s Display the name of the UNIX system. This option is the default; if no other options are listed, it is used.
-v Display the version of the UNIX system. The version is usually set by the local system administrator.
-S The super-user may change the system name and the nodename by using the -S option. The system name can only contain eight characters. Not supported on some systems.


The uname command writes to the standard output.


The most common use of uname is to find out which system you are using. Many users set their shell prompt (PS1) to the name of their system. This is especially useful if you have access to multiple systems. If you have your prompt set on each system to the system's name, then you seldom get lost. uname is often used in shell scripts where control of the script is based on the information returned by uname.

Another reason for the uname command is the UUCP facility on UNIX. The UUCP facility transfers files and executes commands remotely among UNIX systems. The uname command provides a way for the UUCP commands to know the name of a specific system.


In this activity you use the uname command to display all of the information about your system. Begin at the shell prompt.

1.  Type uname -a and press Return to display the information about your system.
  cj> uname -a
  cj   cj  4.0  1  80386

The first cj is the system name, the second is the nodename, 4.0 is the UNIX release, 1 is the version, and 80386 is the hardware type.
2.  Type PS1="$" and press Return. This resets your shell prompt to the system default.
3.  Type PS1="`uname`>" and press Return. This sets your shell prompt to the name of your system.
  $ PS="`uname`>"
  cj> _
4.  Turn to Module 85 to continue the learning sequence.

Previous Table of Contents Next