问题
If I'm in the Terminal and I want to exit or cancel a command how would I do so? Escape does nothing and hitting the up arrow copies the command.
回答1:
Ctrl + C is used to kill a process with the signal SIGINT, and can be intercepted by a program so it can clean its self up before exiting, or not exit at all.
Ctrl + Z is used for suspending a process by sending it the signal SIGSTOP, which cannot be intercepted by the program.
Random fact:
If you were writing a long command such as $ cd /User/myname/Desktop -r grep | .*.* and want to delete it press Ctrl + U.
回答2:
Type \c and hit return. That will clear the current input statement.
来源:https://stackoverflow.com/questions/40515492/how-do-i-exit-or-cancel-inline-commands-in-the-terminal