How to Check System Uptime in Linux (5 Methods)

About 80% of all electronics in the world run on Linux, which speaks volumes about how well-optimized the Linux kernel really is. One of the areas where Linux is extensively used is servers, and you might have seen Linux server administrators using the command line instead of a GUI. Their daily task involves checking the uptime of these electronics. If you’re new to Linux, let’s look at how to check the uptime of your Linux system in this guide.

1. Check Linux System Uptime using uptime command

One of the simplest ways to know the uptime of your Linux server or machine is by using the uptime command. It comes with two options, including -s and -p. Here’s the syntax to use the uptime command on Linux:

uptime

Option -s refers to “uptime since” and shows you the date and time since your PC has been active. Here’s the syntax to use the uptime command with the -s option:

uptime -s

Finally, the -p option refers to “pretty format” and shows you just the hours and minutes since uptime in bold format. Here’s the syntax:

uptime -p

2. Check Linux system uptime using Top command

Top is a built-in command line tool that’s used to check the active and running processes in Linux PCs. It also shows you the amount of memory used, the average load, the total swap/cache used, and the uptime. Here’s the syntax to use the top command:

top

3. Check Linux System Uptime using htop command

Htop is a fancier, cleaner version of the Top command. It induces colors and separates the text fields beautifully so that users can easily differentiate between what is what. Htop doesn’t come preinstalled on most Linux distros by default so here’s how to install it first.

# On Ubuntu/Debian-based distros

sudo apt install htop

# On Fedora/CentOS

sudo dnf install htop

# On Arch/Arch-based distros

sudo pacman install htop


# On OpenSUSE
sudo zypper install htop

Once installed, type the following command and hit enter.

htop

Htop also has plenty of options which you can list by using the command htop –help. One of our favorites is the -t option, which displays the location of the active and running processes in a tree structure. If you wish to learn more about the top and htop commands, check out our essential Linux commands guide.

4. Check Linux System Uptime using W command

The “w” command is used to find out info about the users that are logged in and what they’re doing. It also shows how long the system has been running, how many users are logged in, and the average load. Just launch the terminal and type “w” to find the uptime.

w

5. Check Linux System Uptime using neofetch command

Neofetch is a command that’s mainly used to check the Linux version or any info pertaining to your Linux system. But, you can also use it to check the uptime on Linux. To install neofetch, use the following commands:

# For Ubuntu/Debian-based distros

sudo apt install neofetch

# For Fedora/CentOS

sudo dnf install neofetch

# For Arch-based distros

sudo pacman -S neofetch

# For OpenSUSE

sudo zypper install neofetch

To use the command, launch the terminal and type the following command:

neofetch

Did we miss any other commands that help users find the uptime of their Linux systems? Let us know in the comments section below.

Comments 1
  • pinki says:

    Where do I get the runtime in seconds that dmesg displays?

    When displaying via

    alias seedmesg=’sudo;watch -n 1 “sudo dmesg | tail -20″‘

    it is not really clear whether the display is current or already minutes old – here I would like to get the ‘time since system start in seconds’ from somewhere (and display it somehow – other part)

Leave a Reply