DevOps Learning Notes
2 Followers
In this lecture you are learning below concepts:
User Configuration Files:
When user account is created in Linux servers it by default create group also with the same name as user and the configurations are updated to the configuration file. Below are the important configuration files that will be updated.
Process Management:
In Linux when we run a command it will load the command into real memory and that creates a process.
Process: A Linux process is a command or program running in the Linus operating system. It is also Daemon: A service that run continually since the system start up time to system shutdown that process called as daemon.
Notes:
Parent Process: These are processes that create other processes during run-time.
Child processes – These processes are created by other processes during run-time. You can see the parent process id (PPID) in the process table.
Process States: Once process created it’s ready to schedule for processor and below are the different states that process.

Running: It is either running (it is current process in the system) or it’s ready to run.
Waiting: A process is waiting for an event to occur or to process for system resource. The kernel also differentiates two types of waiting process: Interruptible waiting process can be interrupted by a signal. Uninterruptible process – are waiting directly on hardware conditions and cannot be interrupted by any event/signal.
Stopped – in this state, a process has been stopped, usually by receiving a signal. For instance, a process that is being debugged.
Zombie Process: A Process completed or dead, it has been halted but it still has an entry in the process table.
Linux Commands:
Below are the commands that you can use to work with linux process.
ps: To display currently active process.
Example:
[root@ip-172-31-53-144 ~]# ps
PID TTY TIME CMD
3303 pts/0 00:00:00 sudo
3304 pts/0 00:00:00 su
3305 pts/0 00:00:00 bash
3366 pts/0 00:00:00 ps
[root@ip-172-31-53-144 ~]#
ps -ef: To check currently running process in Linux.
Example:
[root@ip-172-31-53-144 ~]# ps –ef
UID PID PPID C STIME TTY TIME CMD
root 2 0 0 23:55 ? 00:00:00 [kthreadd]
root 3 2 0 23:55 ? 00:00:00 [rcu_gp]
root 4 2 0 23:55 ? 00:00:00 [rcu_par_gp]
root 5 2 0 23:55 ? 00:00:00 [kworker/0:0-cgr]
ps aux: To see a detailed list of process running the server.
a – All users
u – Shows the user/owner
x – List all processes when used together with the a option
Example:
[root@ip-172-31-53-144 ~]# ps aux
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
root 2 0.0 0.0 0 0 ? S 23:55 0:00 [kthreadd]
root 3 0.0 0.0 0 0 ? I< 23:55 0:00 [rcu_gp]
root 4 0.0 0.0 0 0 ? I< 23:55 0:00 [rcu_par_gp]
root 5 0.0 0.0 0 0 ? I 23:55 0:00 [kworker/0:0-cgr]
root 6 0.0 0.0 0 0 ? I< 23:55 0:00 [kworker/0:0H-ev]
Explanation:
man: man is the command to check more details and more flag details about command.
Example: #man mkdir
kill : To kill the running process.
Example:
#kill -9 <pid> : To kill the process forcely
#kill <pid>: To kill the process normally
If the process is daemon, we no need to kill the process. Instated of killing the process you can stop the service or you can restart the service using systemctl command.
Example:
#systemctl stop sshd
Performance Management:
If the system is running slow then you need to check the compute, network, io resources utilization as shown in the below diagram.

On a very high level, following are the four subsystems that needs to be monitored.
CPU:
You should understand the four critical performance metrics for CPU:
Run Queue:
CPU Utilization:
Load Average:
This indicates the average CPU load over a specific time period.
On Linux, load average is displayed for the last 1 minute, 5 minutes, and 15 minutes. This is helpful to see whether the overall load on the system is going up or down.
For example, a load average of “0.75 1.70 2.10″ indicates that the load on the system is coming down. 0.75 is the load average in the last 1 minute. 1.70 is the load average in the last 5 minutes. 2.10 is the load average in the last 15 minutes.
Network :
I/O :
Memory :
There are various tools available to monitor Linux system performance. For example: top, free, ps, iostat, vmstat, mpstat, sar, tcpump, netstat, iozone, etc
How to solve Performance issues:
Performance Commands:
Top : To check linux server performance.
Example:
top - 00:18:38 up 23 min, 1 user, load average: 0.06, 0.08, 0.03
Tasks: 97 total, 1 running, 54 sleeping, 0 stopped, 0 zombie
%Cpu(s): 6.2 us, 0.0 sy, 0.0 ni, 93.8 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st
KiB Mem : 987924 total, 261176 free, 92996 used, 633752 buff/cache
KiB Swap: 0 total, 0 free, 0 used. 748088 avail Mem
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
1 root 20 0 123596 5496 3944 S 0.0 0.6 0:02.01 systemd
2 root 20 0 0 0 0 S 0.0 0.0 0:00.00 kthreadd
3 root 0 -20 0 0 0 I 0.0 0.0 0:00.00 rcu_gp
4 root 0 -20 0 0 0 I 0.0 0.0 0:00.00 rcu_par_gp
6 root 0 -20 0 0 0 I 0.0 0.0 0:00.00 kworker/0:0H-ev
8 root 0 -20 0 0 0 I 0.0 0.0 0:00.00 mm_percpu_wq
Explanation:
free: Check Memory Utilization
Example:
[root@ip-172-31-53-144 ~]# free -m
total used free shared buff/cache available
Mem: 964 90 255 0 618 730
Swap: 0 0 0
[root@ip-172-31-53-144 ~]#
Cat /proc/cpuinfo: To check how many core cpu’s are attached to server and processor attributes.
Example:
[root@ip-172-31-53-144 ~]# cat /proc/cpuinfo
processor : 0
vendor_id : GenuineIntel
cpu family : 6
model : 63
model name : Intel(R) Xeon(R) CPU E5-2676 v3 @ 2.40GHz
stepping : 2
microcode : 0x49
cpu MHz : 2400.053
cache size : 30720 KB
vmstat: To check more details about memory usage.
Example:
[root@ip-172-31-53-144 ~]# vmstat
procs -----------memory---------- ---swap-- -----io---- -system-- ------cpu-----
r b swpd free buff cache si so bi bo in cs us sy id wa st
0 0 0 261404 2088 631868 0 0 106 193 46 176 1 1 97 1 0
[root@ip-172-31-53-144 ~]#
netstat: To command to check network statistics.
Example:
Proto Recv-Q Send-Q Local Address Foreign Address State
tcp 0 304 ip-172-31-53-144.ec:ssh broadband.actcorp:14515 ESTABLISHED
Active UNIX domain sockets (w/o servers)
Proto RefCnt Flags Type State I-Node Path
unix 3 [ ] DGRAM 11536 /run/systemd/notify
unix 2 [ ] DGRAM 11537 /run/systemd/cgroups-agent
unix 5 [ ] DGRAM 11543 /run/syst
iostat: To check for input-output statistics and performance of device.
Example:
[root@ip-172-31-53-144 ~]# iostat
Linux 5.10.162-141.675.amzn2.x86_64 (ip-172-31-53-144.ec2.internal) 02/11/2023 _x86_64_ (1 CPU)
avg-cpu: %user %nice %system %iowait %steal %idle
0.88 0.18 0.52 0.52 0.31 97.59
Device: tps kB_read/s kB_wrtn/s kB_read kB_wrtn
xvda 7.80 99.95 181.52 231294 420060
[root@ip-172-31-53-144 ~]#