Howto stop or terminate Linux command process with CTRL + C

Q. Sometime I type command and accidentally hit the [ENTER] key and immeditly realized that it was wrong command. How do I stop process assuming that process is not going in background? For example
cp /path/* /wrong/path

Stop or terminate Linux command process with CTRL + C

A. To stop process hit CTRL + C, for example, you entered:
$ cp -r /path/* /wrong/path

To stop the command hit CTRL+C and retype the command:
$ cp -r /path/* /correct/path


🐧 Get the latest tutorials on Linux, Open Source & DevOps via RSS feed or Weekly email newsletter.

🐧 4 comments so far... add one

CategoryList of Unix and Linux commands
File Managementcat
FirewallAlpine Awall CentOS 8 OpenSUSE RHEL 8 Ubuntu 16.04 Ubuntu 18.04 Ubuntu 20.04
Network Utilitiesdig host ip nmap
OpenVPNCentOS 7 CentOS 8 Debian 10 Debian 8/9 Ubuntu 18.04 Ubuntu 20.04
Package Managerapk apt
Processes Managementbg chroot cron disown fg jobs killall kill pidof pstree pwdx time
Searchinggrep whereis which
User Informationgroups id lastcomm last lid/libuser-lid logname members users whoami who w
WireGuard VPNAlpine CentOS 8 Debian 10 Firewall Ubuntu 20.04
4 comments… add one
  • web design guy Aug 2, 2009 @ 21:18

    I read that typing ‘reset’ works, even if you cant see it typing. I just use ctrl+c

  • takalani Oct 25, 2013 @ 7:45

    ./ManualManageDB.shn /user/SHARK/log_files/sms.cfg 131022

    how can i stop that command, it is loading data into mysql table.

  • Ruben Sep 2, 2016 @ 10:53

    Is there a way I can stop a command without actually switching focus to the terminal window running the command? More specifically I’m trying to stop a script that switches focus to other window. It’s a script running xdotool commands and sometimes it goes wrong and needs to be stopped quickly.

    • anon Sep 14, 2017 @ 5:33

      Try opening a terminal and running “top”
      Then press “k” and enter the procedure number.

Leave a Reply

Your email address will not be published.

Use HTML <pre>...</pre> for code samples. Problem posting comment? Email me @ webmaster@cyberciti.biz