0
0
Linux CLIscripting~20 mins

nohup for persistent processes in Linux CLI - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Persistent Process Pro
Get all challenges correct to earn this badge!
Test your skills under time pressure!
💻 Command Output
intermediate
2:00remaining
What is the output of this nohup command?
You run the command nohup sleep 10 & in a terminal. What will be the immediate output shown in the terminal?
Linux CLI
nohup sleep 10 &
Anohup: ignoring input and appending output to 'nohup.out'
Bsleep: command not found
CNo output, just returns to prompt immediately
DError: nohup requires a command argument
Attempts:
2 left
💡 Hint
Think about what nohup does with output when running a command in background.
🧠 Conceptual
intermediate
2:00remaining
Why use nohup with background processes?
Which of the following best explains why you use nohup when running a process in the background?
ATo run the process with higher priority
BTo speed up the process execution by using more CPU cores
CTo keep the process running even after the terminal is closed or you log out
DTo automatically restart the process if it crashes
Attempts:
2 left
💡 Hint
Think about what happens to normal background processes when you close the terminal.
🔧 Debug
advanced
2:00remaining
Why does this nohup command fail to keep process running?
You run nohup python myscript.py and then close the terminal, but the script stops immediately. What is the most likely reason?
Linux CLI
nohup python myscript.py
Anohup only works with compiled binaries, not scripts
BYou forgot to add & to run it in background
CThe script reads input from terminal and blocks, causing it to stop
DThe script has a syntax error and exits immediately
Attempts:
2 left
💡 Hint
Think about how to run commands in background with nohup.
📝 Syntax
advanced
2:00remaining
Which command correctly runs a persistent process with nohup and redirects output?
Choose the correct command to run myapp persistently with nohup, sending all output to app.log and running in background.
Anohup myapp & 2>&1 > app.log
Bnohup myapp & > app.log 2>&1
Cnohup myapp 2>&1 > app.log &
Dnohup myapp > app.log 2>&1 &
Attempts:
2 left
💡 Hint
Remember the order of output redirection and background symbol matters.
🚀 Application
expert
3:00remaining
How many lines will nohup.out contain after running this command?
You run nohup bash -c 'for i in {1..5}; do echo $i; sleep 1; done' and wait until it finishes. How many lines will the nohup.out file contain?
A5
B0
C1
D10
Attempts:
2 left
💡 Hint
Each echo prints one line, and output goes to nohup.out by default.