ps command can be used with different switches.
To know more details use man command with it.
ps: To list the process associated with our current Bash shell terminal
ps -f: To list processes along with the parent process ID associated with the current terminal
ps -lf: To list processes with the parent process ID along with the process state, the column with S (state) shows the current state of a process, such as R for running and S for suspended state
ps -ef:To list all the processes running in the operating system including system processes.The process names in [] are kernel threads
ps –ef | grep "process_name" : To find a particular process
to terminate a process:
kill pid_of_process_to_be_killed
Many a time, if the process is not killed by the $ kill command, you may need to pass additional option to ensure that the required process is killed, which is shown as follows:
kill -9 pid_of_process_to_be_killed
We can terminate the process by the name of a process instead of using the process ID as follows:
pkill command_name
pkill sleepOr:
pkill -9 command_name
To know more about various flags of kill
kill –l
This displays all the signals or software interrupts used by the operating system. When we enter the $ kill command, the operating system sends the SIGTERM signal to the process. If the process is not killed by this command,then we enter the following command:
kill -9 process_name
This sends SIGKILL to the process to be killed.
No comments:
Post a Comment