Monday, July 22, 2013

Process Management in Linux


Every time a program or command is run, a process is created for it. These processes are all unique and identified by the process identification (PID).

Here are some of the process management commands you can use:
ps Displays information about running processes

kill Terminates a process 

pgrep Finds a process based on its PID

pidof Displays all processes related to a service or command

top Monitors system resources (similar to Task Manager in Windows)

renice Adjusts the priority of a particular process

1-To view processes with more detailed information, you can use the following command:
# ps u
Or you could also use following command for more detail.
# ps aux

2-What happens if any process running on your system becomes out of control? you can use the kill command to terminate the process, even if it isn’t responding.
Syntax: kill PID

To find the PID(s) belonging to the SSH service, use the following:
# pidof sshd
4286
To achieve the same information you can also use the pgrep command:
# pgrep sshd
4286
Where 4286 is pid of sshd service
To kill the process forcefully the SSH service, you can use the following:
# kill 4286

top This command gives you an overview of processes on the system, including memory usage, CPU utilization, and more. Look the output as shown in figure (top 1.0).
#top                            
                                                                              top 1.0

You can use the renice command to change priority on the CPU.
Syntax: renice <priority> [options]
Options:
-p PID Changes process priority for a particular PID
-u user Changes process priority for a particular user(s)

The priority values range from –20 (very high priority) to 20 (very low priority).
For example following command will change the priority as -2 for pid 3874.
# renice -2 3874

Using the free Command The free command allows you to display the amount of free and used memory on the system. To do so, type the following at a shell prompt:
#free
 
Using the System Monitor Tool
The Resources tab of the System Monitor tool allows you to view the current CPU usage on the system.
To start the System Monitor tool, either select Applications > System Tools >? System Monitor from the panel, or type gnome-system-monitor at a shell prompt. Then click the Resources tab to view the system's CPU usage and Memory usage, (look figure System Monitor 1.0 ).

dixitmicroit.blogspot.com
System Monitor 1.0

No comments:

Post a Comment