To execute a shell script in background and without an interruption, we use nohup command. For example:

$nohup mytest.sh &
Press ALT
Press Enter

Is there any drawback or disadvantage of this nohup utility as this is not a UNIX / LINUX inbuilt command?

  • 1
    Check if using screen could be a better alternative for you. – ott-- Mar 27 '15 at 19:42
  • What @ott-- said. There is also tmux. – Faheem Mitha Mar 27 '15 at 19:52
  • 1
    What do you mean by "this is not a UNIX / LINUX inbuilt command"? nohup has been part of Unix for four decades. Do you mean that it's not builtin to the shell? … … … … … … And what's the deal with the ALT and Enter? … … … … And what does this question have to do with Oracle VM Server? – Scott Mar 27 '15 at 19:59
  • I would like to know the purpose of "Press ALT"... – Lambert Mar 27 '15 at 20:00
  • I still don't know why are you guys suggesting terminal multiplexers when he wanted an explanation about the nohup disvantages – user34720 Mar 27 '15 at 20:06

The disvantages of using nohup would be:

  • No stdout messages. You will have to follow the nohup.out file to check everything your command is doing. This is the place where nohup will print things. It is an advantage depending on the point of view.
  • No stderr output. You will have to manually redirect those messages.

And these two are not drawbacks, but interesting points about nohup:

  • It's not a builtin command(in case of bash), but it makes part of the GNU\coreutils package. Almost all distributions package it and install as default. More easy to have nohup installed on your system than tmux, screen or another screen multiplexing tool.
  • Some shells like tcsh have their own version of nohup. Isn't even a drawback, but you have to be aware of how it works if you are planning to use another *NIX/BSD system.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.