Check all processes except those of session leaders
For viewing processes except for session leaders, execute command ps separated with option -d
What are session leader processes?
For every group of processes, a unique session is assigned and, the session leader process is the first process with process id in a unique session. Shell Script to view processes excluding session leader processes :
Shell Script :
#!/bin/bash function ProCheck() { ps -d } ProCheck()
Output :
Shell Scripting – How to view Processes?
In this article, let’s explore how we can view current processes running on a Linux Server.
Linux machine gives users the option of multitasking hence naturally there will be multiple processes running on a session and also these processes are important fundamental components of Linux OS, Hence System Administrators may need to be aware of all processes and on what terminals they are running. For getting the list of all processes running on the machine, Linux gave a utility called ps, which provides the information of processes running on the Machine, here ps stands for Process Status.
Syntax :
ps {options}
The outcome generated by the ps command contains 3 fields namely :
- PID: This is the unique id associated with each process.
- TTY: This Value defines the type of terminal the user is using.
- CMD: This value defines the name of the command by which the process got launched.
Now let us see different types of ps commands that can be executed on a Linux Server with running example scripts running those commands.