There are many command line and graphical monitoring tools to view system statistics on Linux and Unix operating systems.
The most popular and widely used tool is top.
How to save the output of the Top command to a file
There are also some good alternatives.
gotop – a tool for monitoring system activity in Linux
🔍 Install Bashtop – Monitor Resources from Terminal for Linux | macOS | FreeBSD
Using top and top-like programs, we can get a summary of the system as well as a list of the processes or threads that the Linux kernel currently controls. Today we will see another command line utility called Saidar.
Saidar is a simple tool for viewing Linux system statistics and resource usage in real time.
It is part of the libstatgrab library that can be used to access key system statistics including CPU, process, load, memory, swap, network I / O, disk I / O, and file system information.
It is written in C and tested on GNU / Linux and various Unix-like distributions such as FreeBSD, NetBSD, OpenBSD, Solaris, DragonFly BSD, HP-UX, and AIX.
Installing Saidar on Linux
Saidar is available in the default repositories of popular Linux distributions.
$ sudo apt install saidar
Saidar is available in the EPEL repository for CentOS 7. Enable the EPEL repository using the command:
$ sudo yum install epel-release
Then install Saidar on CentOS 7 using the command:
$ sudo yum install saidar
$ sudo dnf install saidar
$ sudo zypper install saidar
Viewing Linux System Statistics with Saidar
To view the current system statistics with Saidar on Linux, simply run:
Hostname : itsecforu Uptime : 05:58:30 Date : 2020-09-15 17:10:46 Load 1 : 0.65 CPU Idle : 97.14% Running : 51 Zombie : 0 Load 5 : 0.63 CPU System: 0.75% Sleeping : 222 Total : 277 Load 15 : 0.67 CPU User : 8.68% Stopped : 2 No. Users : 1 Mem Total : 7869M Swap Total: 2047M Mem Used : 39.65% Paging in : 0 Mem Used : 3120M Swap Used : 0B Swap Used : 0.00% Paging out: 0 Mem Free : 4749M Swap Free : 2047M Total Used: 31.46% Disk Name Read Write Network Interface rx tx loop0 0B 0B tap-d8f1eebb39f 0B 0B loop1 0B 0B mpqemubr0 0B 0B loop2 0B 0B virbr0 0B 0B loop3 0B 0B wlp9s0 86B 57B loop4 0B 0B enp5s0 0B 0B loop5 0B 0B mpqemubr0-dummy 0B 0B loop6 0B 0B lo 0B 0B loop7 0B 0B virbr0-nic 0B 0B sda 0B 28672B sda1 0B 28672B Mount Point Free Used sr0 0B 0B /sys 0B - sdb 0B 0B /proc 0B - loop8 0B 0B /dev 3890M 0.00% loop9 0B 0B /dev/pts 0B - loop10 0B 0B /run 785M 0.24% loop11 0B 0B / 44051M 90.09% loop12 0B 0B /sys/kernel/securit 0B - loop13 0B 0B /dev/shm 3487M 11.36% loop14 0B 0B /run/lock 5116K 0.08% loop15 0B 0B /sys/fs/cgroup 3934M 0.00% loop16 0B 0B /sys/fs/cgroup/unif 0B - loop17 0B 0B /sys/fs/cgroup/syst 0B - loop18 0B 0B /sys/fs/pstore 0B - loop19 0B 0B /sys/fs/bpf 0B - loop20 0B 0B /sys/fs/cgroup/pids 0B - loop21 0B 0BTotal /sys/fs/cgroup/cpu, 0B - /sys/fs/cgroup/memo 0B -/sys/fs/cgroup/net_ 0B -/sys/fs/cgroup/perf 0B -/sys/fs/cgroup/devi 0B
As you can see from the above output, the top line displays the following information: the hostname of the Linux system, the total uptime, and the current date and time. The second line displays CPU usage statistics, for example:
- CPU load,
- the total number of processes,
- total number of running / sleeping / stopped / zombie processes,
- and the total number of users logged in.
The third line displays information about memory usage, for example:
- Total amount of memory,
- how much memory is currently in use
- and how much memory is free.
- swap usage (shared, used and free)
All memory usage information is shown in MB.
- disk partitions,
- loopback devices,
- Disk I / O speed,
- no network cards available,
- network input / output,
- system mount points,
- the total percentage of free and used disk space for each file system.
Like the top command, Saidar will continue to run and monitor system resources until you manually exit it by pressing q.
Display system statistics in color
To enable color output use -c:
$ saidar -c
Change refresh interval
By default, Saidar refreshes statistics every 3 seconds.
You can change this update delay interval with the -d flag.
$ saidar -d 5
Here I have set the refresh interval to 5 seconds.
Caydar will update statistics every 5 seconds.
You can even combine parameters to get the desired result.
$ saidar -c -d 2
As per the above example, Saidar will output the system statistics in color and update the statistics every 2 seconds.
To display the Saidar help topic, run:
$ saidar -h
Usage: saidar [-d delay] [-c] [-v] [-h] -d Sets the update time in seconds -c Enables coloured output -v Prints version number -h Displays this help information. Report bugs to <https://libstatgrab.org/issues>.