Can I change the name of `nohup.out`?
When I run nohup some_command &
, the output goes to nohup.out
; man nohup
says to look at info nohup
which in turn says:
If standard output is a terminal, the command's standard output is appended to the file 'nohup.out'; if that cannot be written to, it is appended to the file '$HOME/nohup.out'; and if that cannot be written to, the command is not run.
But if I already have one command using nohup
with output going to /nohup.out
and I want to run another, nohup
command, can I redirect the output to nohup2.out
?
Solution 1:
nohup some_command &> nohup2.out &
and voila.
Older syntax for Bash version < 4:
nohup some_command > nohup2.out 2>&1 &
Solution 2:
For some reason, the above answer did not work for me; I did not return to the command prompt after running it as I expected with the trailing &. Instead, I simply tried with
nohup some_command > nohup2.out&
and it works just as I want it to. Leaving this here in case someone else is in the same situation. Running Bash 4.3.8 for reference.