Running a process in background/foreground in linux
Run process in background
To run a command in background, you can use following command at command prompt
Above command will make your process run in background. You need to make sure that process is finished before logging off. A process run by above command will be terminated as soon as you logout.
If you want to run a command in background even after you logout then you can use following command
nohup Run a command immune to hang ups, with output to a non-tty.
This command will run your process in background even if you logs out.
Making current process to run in background
You can make current process as a background process by issuing following commands.
$ bg
You need to remember that the process is running in background, if you logs out then process will be terminated. You can disown to avoid killing the process after you close the terminal.
$ bg
$ disown
Execute following command to run any process in background
You can find process id by issues ps command. It displays the list of currently running process and their process ids. Use ps aux to see all the process currently running on your system including from other users. Use top to get updated list of all the processes running currently.
Run a process in foreground
Related Post
Comments
Leave a Reply