Linux - Lab 11: Process and Service Management

Process and Service Management

In Lab 11: Process and Service Management, participants typically focus on mastering the tools and commands for monitoring and managing processes and services in a Linux environment. This lab involves using commands such as ps to display information about running processes, kill to terminate processes, and top for real-time monitoring. Participants may also explore tools like systemctl for managing services and journalctl for accessing system logs. The lab aims to provide hands-on experience in efficiently handling processes and services, enabling participants to diagnose issues, optimize system performance, and control services effectively. Successful completion of Lab 11 equips participants with essential skills for process and service management in Linux, crucial for maintaining system stability and performance.

Lab:

Listing processes

#To list all currently running processes with all information
ps -el

#To list currently currently running processes with user, PID, PPID, terminal, command.
ps –eLf
ps –efH
ps  –eo  user,pid,ppid,tty,command
pstree

To kill a process

#To kill a program
kill <PID>      

#To kill a program immediately
kill  -9  <PID>

#To kill process by name
pkill  <NAME>

#To kill all processes with given name
killall   <NAME>

Managing services using systemctl command

#During run-time
systemctl  start <SERVICENAME> 
systemctl  stop <SERVICENAME> 
systemctl  restart  <SERVICENAME> 
systemctl  status  <SERVICENAME> 

#At start-up
systemctl  enable  <SERVICENAME> 
systemctl  disable  <SERVICENAME>

Run-level commands

#To check current runlevel
runlevel

#To change systemctl runlevel
init <0-6>