0

I'm using Centos 6, bash version 4.1.2.

In my old centos 5 box (I don't have it any longer), I could type part way through a command, and when I discovered I didn't want to run that command, I would hit ctrl-c to cancel and get a new line on the prompt.

With my new install, if I hit ctrl-c while typing up a command I actually get a '^C' inserted in the current position of the line before the command cancels and a new prompt line is available.

No big deal, but if I go back through my history its now full of commands with '^C' in them, which is something I'd like to avoid because I use my history a lot.

So, any idea how I can use ctrl-c to cancel, but not get a '^C' inserted in the line?

lonestar21
  • 1,113
  • 2
  • 13
  • 23
  • @JohnKugelman Thanks, but I'm using ctrl-c because I want to keep the command as I typed it visible in case I want to copy-paste in a few minutes. My question is about a change of behaviour when using ctrl-c. – lonestar21 Mar 17 '14 at 17:51
  • If you use `Ctrl-U`, you can paste it later with `Ctrl-Y`. – John Kugelman Mar 17 '14 at 17:51
  • Are you saying that when you run `history` or hit Up Arrow, you actually see "^C" in the commands? – that other guy Mar 17 '14 at 18:29

1 Answers1

5

From this SuperUser question, this is what you need to do to get back to the old behaviour of ctrl+c:

stty -echoctl

I've just tried it on my own CentOs 6 machine and verified that it does what (I think) you're looking for :)

Community
  • 1
  • 1
grdryn
  • 1,972
  • 4
  • 19
  • 28