Is CTRL+C incorrect to use to return to command line?

Ctrl+C sends a SIGINT to the program. This tells the program that you want to interrupt (and end) it's process. Most programs correctly catch this and cleanly exit. So, yes, this is a "correct" way to end most programs.

There are other keyboard shortcuts for sending other signals to programs, but this is the most common.


This method is just fine, really.


To abort a long command while typing, I sometimes jump to the start of line, and insert a comment sign, before hitting enter:

Home#Enter

Pos1#Return

This is useful, if I typed a copy command with a long path, for example, and meanwhile observe, that I first need to create the directory, but would like to repeat the command afterwards. Then I just have to take it from the history, delete the hash, and enter it.

In Bash, you can use the shortcut

Alt+#

to remarkify your command, as pointed out in the comments (Thanks, @Zorawar).

Tags:

Linux

Bash