/

Linux Command: uname

Linux Command: uname

In this blog post, we will explore the uname command and its various options, which are used to retrieve information about the current machine and the operating system running on it.

By calling uname without any options, you can obtain the codename of the operating system as output. For example:

uname output without options

The m option provides information about the hardware name, such as x86_64, while the p option displays the processor architecture name, such as i386. Here’s an example:

uname output with m and p options

To retrieve the operating system name, release, and version, you can use the s, r, and v options respectively. Here’s how it looks:

uname output with s, r, and v options

If you need to know the node network name, you can use the n option. Here’s an example:

uname output with n option

To obtain all available information about the machine and the operating system, you can use the a option. Here’s an example:

uname output with a option

For macOS users, an additional command called sw_vers is available to retrieve more detailed information about the macOS operating system. Keep in mind that this command displays information about the macOS version, whereas the above outputs show the Darwin version (the kernel) as 19.6.0.

Fun fact: The kernel of macOS is called Darwin. It serves as the “core” of the operating system, while the macOS operating system as a whole is commonly referred to as macOS. On the other hand, Linux is the kernel for Linux-based systems, with GNU/Linux being the proper name for the operating system, although it is commonly called Linux.

Here’s an example of using the sw_vers command on macOS:

sw_vers command output

It’s important to note that the uname command works not only on Linux but also on macOS, WSL (Windows Subsystem for Linux), and any UNIX environment.

tags: [“Linux”, “command line”, “uname”, “OS”, “operating system”]