Ctrl+C vs. Ctrl+Z: Master Your Bash Terminal Like a Pro

Ever found yourself in the Bash terminal, needing to stop a running command or just pause it for a bit? You've probably instinctively reached for Ctrl+C. But have you ever tried Ctrl+Z? While they might seem similar, these two keyboard shortcuts do fundamentally different things. Understanding the distinction is key to truly mastering your command line.

Ctrl+C: The "Kill Switch" (SIGINT)

When you hit Ctrl+C, you're sending a SIGINT (Signal Interrupt) to the foreground process. Think of it as telling a program, "Hey, stop what you're doing and exit gracefully!"

Ctrl+Z (SIGTSTP - Signal Terminal Stop)

Where as, Ctrl+Z is a game-changer for terminal multitasking. This shortcut sends a SIGTSTP (Signal Terminal Stop) to the foreground process. Instead of killing it, you're telling it to "Pause for a moment, I need to do something else."

 Ctrl+CCtrl+Z
What it doesTerminates the running command.
Program gets a chance to clean up any open files or processes before it shuts down.
Suspends the running command.
Moved it to the background in a paused state. The process is still in memory, just temporarily halted.
When to use itTo completely stop a command.To jump back to your terminal to run another command without closing your current work.
The outcomeThe process is gone. You can't resume it.The process is suspended.

Resuming Suspended Processes

The beauty of Ctrl+Z is that your work isn't lost; it's just on hold. You have a few ways to bring a suspended process back to life:

  • jobs: you can use the jobs command to see a list of all your currently suspended processes. This will show you their job number. See below for example.

    [1]   Stopped                 nano
    [2]-  Stopped                 ping google.com
    [3]+  Stopped                 ping youtube.com
    

     

  • fg [job_number]: to bring a suspended job back to the foreground (where it takes over your terminal again), use fg followed by the job number.
    fg 1  # Brings job number 1 to the foreground
  • bg [job_number]: to continue the suspended job in the background (so it runs without occupying your terminal), use bg followed by the job number.
    bg 1 # Continues job number 1 in the background

Knowing when and how to use Ctrl+Z is a small but powerful trick that can significantly improve your workflow in the Bash terminal, saving you from constantly closing and reopening applications. Give it a try next time you're working in the command line!

This article was updated on July 8, 2025