12 / 55 · 19 Linux & Command Line · Permissions and Processes← prev⊞ allnext →☰ Read as one page
2.6Background Processes
# Run a process in the background
node server.js &
# Output: [1] 1234 (job number and PID)
# List background jobs
jobs
# [1]+ Running node server.js &
# Bring a background job to foreground
fg %1
# Send a running foreground process to background
# Press Ctrl+Z (suspends the process)
bg %1 # Resume it in the background
# Run a process that survives terminal disconnect
nohup node server.js > server.log 2>&1 &
# Output goes to server.log, process continues even if you close the terminal