Back to course

60. Viewing System Information (`uname`, `hostname`)

Linux Basics: From Zero to CLI Hero

Getting to Know Your Machine

When troubleshooting or performing administration, knowing basic system details is essential.

The uname Command

uname prints system information. Run alone, it usually displays the kernel name (Linux).

OptionOutputExample
-sKernel nameLinux
-nNetwork node hostnameubuntu-vm
-rKernel release version5.15.0-86-generic
-vKernel version string#96~22.04.1-Ubuntu SMP ...
-mHardware architecturex86_64
-aAll information (most common)(Combination of all)

bash $ uname -a Linux ubuntu-vm 5.15.0-86-generic #96~22.04.1-Ubuntu SMP ... x86_64 x86_64 x86_64 GNU/Linux

The hostname Command

hostname displays or sets the system's hostname.

bash $ hostname ubuntu-vm

To see the distribution release version, you often check the contents of a file:

bash $ cat /etc/os-release