LinuxCommandLibrary

uname

Print system information

TLDR

Print kernel name

$ uname
copy

Print all available system information
$ uname [[-a|--all]]
copy

Print system architecture and processor information
$ uname [[-mp|--machine --processor]]
copy

Print kernel name, kernel release and kernel version
$ uname [[-srv|--kernel-name --kernel-release --kernel-version]]
copy

Print system hostname
$ uname [[-n|--nodename]]
copy

Print the current operating system name
$ uname [[-o|--operating-system]]
copy

Print the current network node host name
$ uname [[-n|--nodename]]
copy

Display help
$ uname --help
copy

SYNOPSIS

uname [OPTION]...
Common usage:
uname [-a] [-s] [-n] [-r] [-v] [-m] [-p] [-i] [-o]

PARAMETERS

-a, --all
    Prints all available system information.

-s, --kernel-name
    Displays the kernel name (e.g., Linux).

-n, --nodename
    Shows the network node hostname.

-r, --kernel-release
    Outputs the kernel release (e.g., 5.15.0-XX-generic).

-v, --kernel-version
    Prints the kernel version, which includes build date and time.

-m, --machine
    Displays the machine hardware name (e.g., x86_64).

-p, --processor
    Shows the processor type (may be 'unknown' or same as machine).

-i, --hardware-platform
    Prints the hardware platform (may be 'unknown' or same as machine/processor).

-o, --operating-system
    Displays the operating system name (e.g., GNU/Linux).

--help
    Displays a help message and exits.

--version
    Shows version information and exits.

DESCRIPTION

The uname command in Linux is used to print system information. It provides details about the operating system kernel, hostname, hardware architecture, and more. Often used by system administrators and developers, it helps identify the specific environment a program is running on or troubleshooting system issues. For instance, knowing the kernel version is crucial for checking compatibility with new drivers or software updates. The command can display all available information with a single option, or specific pieces of data using individual flags. It's a fundamental utility for understanding the underlying system characteristics without needing to parse multiple configuration files. Part of the GNU Core Utilities, uname is a ubiquitous tool on almost all Unix-like systems.

CAVEATS

The output of uname can vary slightly across different Unix-like systems, even though it's a POSIX standard. Specifically, the information provided by -p (processor type) and -i (hardware platform) options might be 'unknown' or identical to the machine architecture on some systems, as these are GNU extensions and not part of the core POSIX standard. For more detailed and user-friendly OS information, other tools like lsb_release or inspecting /etc/os-release might be preferred.

<I>COMBINATION WITH <B><CODE>-A</CODE></B></I>

The -a or --all option is a convenient shortcut that displays all significant uname information in a single line. This includes kernel name, hostname, kernel release, kernel version, machine hardware name, processor type, hardware platform, and operating system. It's often the first option users try to get a quick overview of the system's identity. However, keep in mind that the output for processor and hardware platform might be redundant or unknown on some systems, as mentioned in the caveats.

HISTORY

The uname command has been a fundamental part of Unix-like operating systems since its early days, established as part of the POSIX.1 standard. Its purpose is to provide programmatic access to system information, making it consistent across different Unix implementations. Over time, while the core functionality remained stable, GNU Core Utilities added specific extensions like the -p and -i options to provide more granular details where available. Its continued inclusion in modern Linux distributions highlights its enduring utility for system identification and scripting.

SEE ALSO

hostname(1), arch(1), lsb_release(1), os-release(5)

Copied to clipboard