| Start | |||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Job handling Creating jobsTo create an job, just append a single You can also make a running process a job by pressing Ctrl + z: Background and foreground a processTo bring the Process to the foreground, the command Now you can interact with the process. To bring it back to the background you can use the Due to the laziness of some Programmers, all these commands also work with a single or just Additionally, just typing Killing running jobsThe sleep process runs in the background with process id (pid) Some common kill signals are shown below. To see a full list, run
Start and kill specific processesProbably the easiest way of killing a running process is by selecting it through the process name as in the following example using (or) a more fool-proof way using The same result can be obtained using Start the script that will eventually killed with the following approach. Let's assume that the command you want to execute and eventually kill is This will create a file in the Then, when you want to kill it use the following script: that will kill exactly the process associated with your command, without relying on any volatile information (like the string used to run the command). Even in this case if the file does not exist, the script assume that you want to kill a non-running process. This last example can be easily improved for running the same command multiple times (appending to the pid file instead of overwriting it, for example) and to manage cases where the process dies before being killed. |
|||||||||||||||
| Check which process running on specific port To check which process running on port 8080 |
|||||||||||||||
Disowning background job This allows a long running process to continue once your shell (terminal, ssh, etc) is closed. |
|||||||||||||||
List Current Jobs |
|||||||||||||||
| List all processes There are two common ways to list all processes on a system. Both list all processes running by all users, though they differ in the format they output (the reason for the differences are historical). This can be used to check if a given application is running. For example, to check if the SSH server (sshd) is running: |
|||||||||||||||
| Finding information about a running process
Example: Here, second column is the process id. For example, if you want to kill the nginx process, you can use the command |
Read Article
https://develop.horje.com/learn/1434/reference