Thursday, 25 August 2011

What is Processes

Process is kind of program or task carried out by your PC. For e.g.
$ ls -lR

Process defined as:
"A process is program (command given by user) to perform specific Job. In Linux when we start process, it gives a number to process (called PID or process-id), PID starts from 0 to 65535."

As We know Linux is multi-user, multitasking Os. It means we can run more than two process simultaneously if we wish. For e.g. To find how many files do we have on your system we may give command like:

$ ls / -R | wc -l

This command will take lot of time to search all files on your system. So we can run such command in Background or simultaneously by giving command like

$ ls / -R | wc -l &

The ampersand (&) at the end of command tells shells start process (ls / -R | wc -l) and run it in background takes next command immediately.
Process & PID defined as:
"An instance of running command is called process and the number printed by shell is called process-id (PID), this PID can be use to refer specific running process."

Following tables most commonly used command(s) with process:
For this purposeUse this CommandExamples*
To see currently running process ps$ ps
To stop any process by PID i.e. to kill processkill    {PID}$ kill  1012
To stop processes by name i.e. to kill processkillall   {Process-name}$ killall httpd
To get information about all running processps -ef$ ps -ef
To stop all process except your shellkill 0$ kill 0
For background processing (With &, use to put particular command and program in background)linux-command  &$ ls / -R | wc -l &
To see if a particular process is running or not. For this purpose you have to use ps command in combination with the grep command  ps -ef | grep  process-U-want-to seeFor e.g. you want to see whether Apache web server process is running or not then give command$ ps -ef | grep httpd
To see currently running processes and other information like memory and CPU usage with real time updates.top
See the output of top command.

$ top


Note
that to exit from top command press q.

No comments:

Post a Comment