What happens when I press Ctrl+C while a command is running?
Quick answer
In a Bash terminal, Ctrl+C usually sends SIGINT to the foreground process group. The command may stop, handle the signal and continue, or respond in another way; Bash’s behavior depends on the shell and job-control circumstances, and programs can handle the signal themselves [S1]. Treat Ctrl+C as a request to interrupt, not a guarantee that everything stops or that no work was changed.
The question, the details, the next step.
A practical checklist
Read and understand the full command before interrupting it.
Check the output and whether the usual shell prompt has returned.
Consider whether the command may already have made changes.
After pressing Ctrl+C, observe the program’s response rather than assuming it stopped.
If the outcome is unclear, note the command and consult its documentation or task owner.
A few more useful answers
Does Ctrl+C always stop a running command?
No. In Bash it usually generates SIGINT, but a program may handle the signal rather than terminate, and the signal’s delivery depends on shell and job-control circumstances [S1].
Does interrupting a command undo what it has already done?
Do not assume so. The signal behavior does not establish whether a particular program has already made changes or whether those changes can be reversed.
Does this behavior apply to every terminal and shell?
The cited description is specific to Bash and its stated shell and job-control setup. It does not establish identical behavior for every shell, terminal, or program [S1].
Sources
References used for this guide.
- [S1] GNU Bash Reference Manual: Signals gnu.org · Checked
