What is a Process?
What is a Process?
Process is kind of program or task in execution.
Each command, program or a script in linux is a process.
Process Management in Linux Shell Scripting
Managing a process
You might have seen some process taking long time to execute. You can run such process in the background.
Example:
ls / -R | wc -l
The above command can be used to find the total count of the files on your system. This takes a long a time, so to get the command prompt and to start an other process, you can run the above command in background.
Running a process in background
ls / -R | wc -l &
The ampersand (&) at the end of command tells the shell to run the command in background.
You will a number printed on your screen. It is the process Id.
So for each process you will have a process Id.
Some of the important commands assosiated with processes.
ps -> display currently running process
kill {PID} -> to kill a particular process
killall {Process-name} -> to kill all the process having the same name.
ps -ag -> to get information about all running process
kill 0 -> to kill all process except your shell
linux-command & -> start a process in background
ps aux -> to get all the details regarding the running process.
ps ax | grep process-name -> to check a particular process.
top -> to see currently running processes and there memory usage.
pstree -> to see currently running processes in a tree structure.
Related posts:
- Shell Scripting Introduction
- Shell Syntax
- Shell - Strings
- Shell - Variables
- Shell - User Intraction
- First Shell Script
- Shell - Arithmetics
- Shell - Case Statement
- Shell - Command Line Arguments
- Shell - For Loop
- Shell - While Loops
- Shell - IF Statements
- Shell - Input Output Redirections
- Shell - Pipes and Filters
- Shell - Process Management
Your IP address1 is: 172.21.0.2