π₯οΈ Linux/Unix: System Info Commands β uname
, hostname
, uptime
Explained
π§² Introduction β Why Learn Linux System Information Commands?
As a Linux user or system administrator, you often need to check system details, such as the OS version, hostname, kernel, or how long the system has been running. Simple tools like uname
, hostname
, and uptime
provide quick insights into system identity, stability, and uptimeβespecially helpful during audits, maintenance, and troubleshooting.
π― In this guide, youβll learn:
- How to view OS and kernel details using
uname
- How to manage system hostnames with
hostname
- How to check system availability and load averages using
uptime
π§ 1. uname
β Kernel and System Information
β
What is uname
?
uname
stands for Unix Name and prints system information such as kernel name, version, and architecture.
π οΈ Syntax:
uname [options]
πΉ Common uname
Options:
Option | Description |
---|---|
-s | Kernel name |
-n | Node (hostname) |
-r | Kernel release |
-v | Kernel version |
-m | Machine hardware name (architecture) |
-a | All system info |
π§ͺ Example:
uname -a
π€ Output:
Linux myserver 5.15.0-91-generic #101-Ubuntu SMP x86_64 GNU/Linux
π§ Useful to determine if you’re on a 64-bit system or which kernel version is in use.
π·οΈ 2. hostname
β View or Set System Hostname
β
What is hostname
?
hostname
displays or sets the network hostname of the system. The hostname identifies your device on a network.
π οΈ Syntax:
hostname [new-name]
π§ͺ Examples:
β View current hostname:
hostname
π€ Output:
myserver
β Set a new hostname (temporary):
sudo hostname devbox
β Permanently change hostname (Ubuntu/Debian):
sudo hostnamectl set-hostname devbox
π§ You may also edit /etc/hostname
and /etc/hosts
manually for full hostname persistence across reboots.
β±οΈ 3. uptime
β Show System Running Time and Load
β
What is uptime
?
uptime
shows how long the system has been running, the number of users, and system load averages for the past 1, 5, and 15 minutes.
π οΈ Syntax:
uptime
π§ͺ Example:
uptime
π€ Output:
14:12:50 up 5 days, 4:33, 2 users, load average: 0.03, 0.05, 0.01
π§ Interpreting Load Average:
0.00
= no load1.00
= fully loaded (per core)- Use
htop
ornproc
to check how many cores are available
π Tool Comparison Table
Command | Description | Output Example |
---|---|---|
uname -a | All system details (kernel, arch, etc) | Linux myserver 5.15… x86_64… |
hostname | System hostname | myserver |
uptime | System running time + load | up 5 days, 2 users, load avg: 0.02 |
π Summary β Recap & Next Steps
These quick system info commands help you check system identity, kernel version, uptime, and load. Theyβre handy in scripts, server audits, and remote debugging sessions.
π Key Takeaways:
- Use
uname -a
to see detailed kernel and architecture info. - Use
hostname
to view or set system hostname. - Use
uptime
to quickly check server stability and load.
β FAQs
β How can I find if my Linux is 32-bit or 64-bit?
β
Run:
uname -m
Output: x86_64
= 64-bit, i686
= 32-bit
β How do I permanently change the hostname in Linux?
β
Use:
sudo hostnamectl set-hostname newname
β What do load averages in uptime
mean?
β
They represent system load over 1, 5, and 15 minutes. Each number should be compared to your core count (use nproc
).
β Can uptime
show past boot times?
π‘ Not directly. Use:
who -b
β Where is hostname stored in Linux?
β
Usually in /etc/hostname
and /etc/hosts
.
Share Now :