Hi I'm using nohup command-name & recently.

My issue is: Terminal screen

When I hit Enter, it will show [1]+ Exit 1. and can't finish the command. How can I run the second command while I'm running nohup?


1 Answer 1


You need to separate the commands using ; (second command would be independent of the first) or && (second would be run only if the first one succeeds).

Then, you need to use the shell with command grouping or use a subshell to make the commands as one (only shell) to nohup and run the commands inside the shell process:

nohup bash -c '{ command_1 && command_2 ;}' &


nohup bash -c '( command_1 && command_2 )' &
  • which means I can't type ENTER before "nohup command-name &" finish?
    – mapping
    Commented Jul 27, 2016 at 19:57
  • @JingNing I don't understand. Didn't you need to run two commands from one go of nohup?
    – heemayl
    Commented Jul 27, 2016 at 19:58
  • No, For example, I run the first command in "nohup first-command &", then I have the second command outside of "nohup first-command &" (like pwd ls cd and so on). Could I run the second command while I'm running the "nohup first-command &"?
    – mapping
    Commented Jul 27, 2016 at 20:22
  • @JingNing That depends on how much time the first command lasts for. See if nohup command_1 &; command_2 works..
    – heemayl
    Commented Jul 27, 2016 at 20:31
  • Hi heemayl, the first command lasts more than one hour.
    – mapping
    Commented Jul 28, 2016 at 13:13

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .