0
0
Linux CLIscripting~5 mins

nohup for persistent processes in Linux CLI - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What does the nohup command do in Linux?
The nohup command runs a process that ignores the hangup signal, so it keeps running even after you close the terminal.
Click to reveal answer
beginner
How do you run a script named backup.sh persistently using nohup?
Use nohup ./backup.sh &. This runs the script in the background and keeps it running after logout.
Click to reveal answer
intermediate
What file does nohup use to save output if no output file is specified?
It saves output to nohup.out in the current directory or home directory if it can't write there.
Click to reveal answer
beginner
Why do we add & at the end of a nohup command?
The & puts the process in the background so you can keep using the terminal immediately.
Click to reveal answer
intermediate
Can nohup keep a process running after a system reboot?
No, nohup only keeps a process running after logout or terminal close. For reboot persistence, use system services or cron jobs.
Click to reveal answer
What happens if you close the terminal after running nohup myscript.sh &?
AThe script keeps running in the background.
BThe script stops immediately.
CThe script pauses until the terminal reopens.
DThe script restarts automatically.
Where does nohup save output if you don't redirect it?
A/dev/null
B/var/log/syslog
Cnohup.out file
DIt discards the output
Which symbol is used to run a command in the background?
A$
B#
C*
D&
Does nohup guarantee a process will survive a system reboot?
ANo, it only survives terminal close or logout.
BYes, it survives reboot automatically.
COnly if combined with <code>cron</code>.
DOnly if run as root.
What is the main reason to use nohup?
ATo speed up a process.
BTo keep a process running after logout or terminal close.
CTo run a process with higher priority.
DTo automatically restart a process if it crashes.
Explain how to use nohup to run a script persistently and why it is useful.
Think about running a long task and closing your terminal without stopping it.
You got /4 concepts.
    Describe the limitations of nohup regarding process persistence.
    Consider what happens when the computer restarts.
    You got /4 concepts.