How to run Linux commands in background even when you logout?

Ans : In Linux/nix by default we cant run the commands in background when we logged. When we try to logout form terminal you will get following error.

surendra@linuxnix.com:~$ exit
There are stopped jobs.
Supose you have logged in to a remote system by using ssh, after starting a script there you thought of logging out from that terminal but the script is still running. At this point we want to run the script even we loggedout.
What we can do is to run a process background though you have logged out ?
This can be achived by using the nohup command. Below is the man help for nohup.

No Hang Up. Run a command immune to hangups, runs the given command with hangup signals ignored, so that the command can continue running in the background after you have logged out.

Syntax:
nohup Command [Arg] &

Example1:

nohup ping google.com &

The following two tabs change content below.
Mr Surendra Anne is from Vijayawada, Andhra Pradesh, India. He is a Linux/Open source supporter who believes in Hard work, A down to earth person, Likes to share knowledge with others, Loves dogs, Likes photography. He works as Devops Engineer with Taggle systems, an IOT automatic water metering company, Sydney . You can contact him at surendra (@) linuxnix dot com.