Skip to content

Did you know?

Ctrl+Z pauses a running command; bg resumes it in the background.

fg brings it back, and jobs lists everything you have paused or sent away.

Explained

Started a long copy or download in the foreground and need your terminal back? You don’t have to cancel it. Press Ctrl+Z to suspend the process, then type bg to let it continue in the background:

rsync -a /data/ /backup/data/
^Z
[1]+  Stopped                 rsync -a /data/ /backup/data/
bg
[1]+ rsync -a /data/ /backup/data/ &

Useful job commands:

  • jobs lists background and stopped jobs with their numbers.
  • fg brings the most recent job back to the foreground; fg %2 picks job 2.
  • disown detaches a job from the shell, so it keeps running after you close the terminal.

For work you already know will run for hours, start it in a tmux or screen session, or with nohup, so an SSH disconnect can’t interrupt it.

Learn more

← All tech tips · Suggest a fix

Back to top