How to manipulate your process status

How to manipulate your process status
There are times when you want to execute an application on the command-line without interrupting the most recent process or application that is running. Whilst this is very basic, I find that n00bs may not be familiar with this trick.

On the command-line, execute a process, e.g., "ping" without the trailing "&" that keeps it running in the background. Hit Ctrl-Z to temporarily stop the process.

$ ping 10.32.1.7
^Z
[1]+ Stopped ping 10.32.1.7

Activate it but run as a background process.

$ bg
[1]+ ping 10.32.1.7 &

Continue doing what you are doing but the process continues to run in the background.

Transfer it back as the current process.

$ fg
ping 10.32.1.7

Now, the process is back as the currently running application.


This entry was posted on Saturday, November 24th, 2007 at 5:56 pm and is filed under Tips & Tricks. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

Leave a Reply