Linux Health Check Commands

Linux Health Check Commands

 
This document contains some of the commonly used linux commands when performing health check on a machine running Linux Operating System.

To view overall performance.
[root@myserver]# top

Note:
- By default is will sort processes based on CPU usage. Press "M" to sort based on memory usage.

To view I/O of storage devices.
[root@myserver]# iostat
[root@myserver]# iostat -d  #Display only disk I/O statistics
[root@myserver]# iostat -n  #Display on network storage devices
[root@myserver]# iostat -m  #Display I/O in MB/s
[root@myserver]# iostat 1 3 #Display I/O every second for 3 times


To check CPU usage at interval of 5 seconds for 3 times.
[root@myserver]# sar -u 5 3
Linux (mysever)  09/29/2013

08:31:15 PM       CPU     %user     %nice   %system   %iowait     %idle
08:31:20 PM       all     16.92      0.00      1.48      0.15     81.45
08:31:25 PM       all     14.65      0.00      0.80      0.10     84.45
08:31:30 PM       all     15.85      0.00      2.02      0.07     82.05
Average:          all     15.81      0.00      1.43      0.11     82.65


To check memory and swap utilization in megabytes.
[root@myserver]# free -m
             total       used       free     shared    buffers     cached
Mem:          3735       3567        168          0        270       2221
-/+ buffers/cache:       1075       2659
Swap:         8191         23       8168


To find out top 10 processes consumed the most memory.
The below command will take the output of "ps -aux", sort the memory column which is column 4 from highest value to lowest and output the first 10 results.
[root@myserver]# ps -aux |sort -nrk 4| head -10


To find out top 10 processes consumed the most CPU.
The below command will take the output of "ps -aux", sort the CPU column which is column 3 from highest value to lowest and output the first 10 results.
[root@myserver]# ps -aux |sort -nrk 3| head -10


To check how many network interface configured.
[root@myserver]# ifconfig -a
eth0      Link encap:Ethernet  HWaddr 11:0B:2D:EF:07:30
          BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 b)  TX bytes:0 (0.0 b)
          Interrupt:16

eth1      Link encap:Ethernet  HWaddr 12:0B:44:FF:47:DF
          inet addr:192.0.0.1  Bcast:192.0.0.255  Mask:255.255.255.192
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:1216011503 errors:0 dropped:0 overruns:0 frame:0
          TX packets:4253525258 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 b)  TX bytes:0 (0.0 b)
          Interrupt:24


To check speed of eth1.
Settings for eth1:
        Supported ports: [ MII ]
        Supported link modes:   10baseT/Half 10baseT/Full
                                100baseT/Half 100baseT/Full
                                1000baseT/Half 1000baseT/Full
        Supports auto-negotiation: Yes
        Advertised link modes:  10baseT/Half 10baseT/Full
                                100baseT/Half 100baseT/Full
                                1000baseT/Half 1000baseT/Full
        Advertised auto-negotiation: Yes
        Speed: 1000Mb/s
        Duplex: Full
        Port: Twisted Pair
        PHYAD: 1
        Transceiver: internal
        Auto-negotiation: on
        Supports Wake-on: g
        Wake-on: d
        Current message level: 0x000000ff (255)
        Link detected: yes


To check if all hard mount filesystems are mounted properly issue command "df -h" and cross check with the file /etc/fstab.

[root@myserver]# cat /etc/fstab
[root@myserver]# df -h


To check who is currently logged in.
[root@myserver]# w


To check login history.
[root@myserver]# last


To check current date & time on the server.
[root@myserver]# date


To check current and previous runlevel.
The below output indicate the current runlevel is 3 and previous was 1 [Single user].
[root@myserver]# who -r
run-level 3 Sep 26 06:20 last=S


To check current and previous runlevel.
The below output indicate the current runlevel is 3 and N indicates the runlevel was not change since boot.

[root@myserver]# runlevel
N 3


To reboot.
[root@myserver]# reboot or [root@myserver]# shutdown -r now
or
[root@myserver]# init 6


To shutdown the Operating System.
By default shutdown command will bring the Operating System to runlevel 1.
[root@myserver]# shutdown


To shutdown the Operating System and poweroff.
[root@myserver]# shutdown -h now


To cancel shutdown.
[root@myserver]# shutdown -c


To list services configured.
[root@myserver]# chkconfig --list


To start a service.
[root@myserver]# service nfs start


To view hardware info.
[root@myserver]# dmidecode
0 (0)
Article Rating (No Votes)
Rate this article
Attachments
There are no attachments for this article.
Comments
There are no comments for this article. Be the first to post a comment.
Full Name
Email Address
Security Code Security Code
Related Articles RSS Feed
Get UUID of Hard Disks [Update]
Viewed 2351 times since Tue, Jul 17, 2018
SPRAWDZONA KONFIGURACJA RSYSLOG I LOGROTATE, JAKO ZEWNĘTRZNEGO SERWERA SYSLOG
Viewed 3971 times since Fri, Nov 30, 2018
stunnel bacula
Viewed 2199 times since Fri, Sep 28, 2018
Tunnel SSH Connections Over SSL Using ‘Stunnel’ On Debian 7 / Ubuntu 13.10
Viewed 3475 times since Fri, Sep 28, 2018
RHEL: Getting/Setting hardware clock’s time
Viewed 3219 times since Sat, Jun 2, 2018
stunnel Howto A Guide to create SSL access to a HTTP-only webserver with stunnel
Viewed 2845 times since Fri, Sep 28, 2018
Fix rpmdb: Thread died in Berkeley DB library
Viewed 21269 times since Fri, Feb 14, 2020
Secure Remote Logging to Central Log Server Using RSYSLOG on CentOS 6 / CentOS 7 and stunnel
Viewed 4230 times since Sun, Dec 6, 2020
Turbocharge PuTTY with 12 Powerful Add-Ons – Software for Geeks #3
Viewed 14858 times since Sun, Sep 30, 2018
How to sort IP addresses in Linux
Viewed 3837 times since Sun, May 20, 2018