uptime
The Linux "uptime" is a command that returns information about how long your system has been running together with the current time, the number of users with running sessions, and the system load averages for the past 1, 5, and 15 minutes.
It can also filter the information displayed at once depending on your specified options.
uptime uses a simple syntax:
uptime [option]
You can run the uptime command without any options like so:
uptime
Show only the running time of the system with the command:
uptime -p
Display the date/time since when the system has been running.
uptime -s
Display uptime’s version information and quick help page with the following command.
man uptime
uptime -h
info uptime
w
The w command provides a quick summary of every user logged into a computer, what each user is currently doing, and what load all the activity is imposing on the computer itself. The command is a one-command combination of several other Unix programs: who, uptime, and ps -a.
$ sudo w
top
The top command is one of the basic commands to monitor real-time system processes in Linux.
It displays system information and running processes information like uptime, average load, tasks running, number of users logged in, number of CPUs & CPU utilization, Memory & swap information. Run top command then hit E to bring the memory utilization in MB.
top -c
who
who command displays a list of users who are currently logged into the computer.
The who command is related to the command w, which provides the same information but also displays additional data and statistics.
who -b
last
The last command displays a list of last logged in users. Last searches back through the file /var/log/wtmp and displays a list of all users logged in (and out) since that file was created.
last reboot -F | head -1 | awk '{print $5,$6,$7,$8,$9}'
/proc/uptime
This file contains information detailing how long the system has been on since its last restart. The output of /proc/uptime is quite minimal.
The first number is the total number of seconds the system has been up. The second number is how much of that time the machine has spent idle, in seconds.
cat /proc/uptime
htop
htop is an interactive process viewer for Linux which was developed by Hisham using ncurses library.
Htop has many features and options compared to the top command.
First, install htop:
RHEL/CentOS 7
wget dl.fedoraproject.org/pub/epel/7/x86_64/Packages/e/epel-release-7-11.noarch.rpm sudo rpm -ihv epel-release-7-11.noarch.rpm
For cPanel & WHM administrators, use wget to get the RPM from http://pkgs.repoforge.org/htop/, then use the rpm -i command.
sudo yum install htop
On Amazon Linux:
sudo yum -y update sudo yum -y upgrade
enable EPEL by changing enabled=0 -> enabled=1
sudo vi /etc/yum.repos.d/epel.repo
then install:
sudo yum install htop
htop
glances
Glances is a cross-platform curses-based system monitoring tool written in Python. We can say all in one place, like the maximum of information in a minimum of space. It uses the psutil library to get information from your system.
Glances capable to monitor CPU, Memory, Load, Process list, Network interface, Disk I/O, Raid, Sensors, Filesystem (and folders), Docker, Monitor, Alert, System info, Uptime, Quicklook (CPU, MEM, LOAD), etc.
glances
procinfo
procinfo gathers some system data from the /proc directory and prints it nicely formatted on the standard output device.
procinfo | grep Bootup
systemd
systemd is a new init system and system manager which was implemented/adapted into all the major Linux distributions over the traditional SysV init systems.
ps -eo pid,comm,lstart,etimes,time,args | grep -i "systemd"