Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

When I kill a process in the terminal using ctrl+c no carriage return is inserted.

I have no idea if I changed a setting inadvertently or what happened. I'm running 11.10.

How can I change the settings so that a carriage return is added after ctrl+c?

share|improve this question
add comment

1 Answer

Having igncr set in the stty settings would make your terminal ignore carriage returns (and pressing return would have no effect), although hitting Ctrl+C would still reload the prompt on a new line. To temporarily reset your tty, run

stty sane

and see below for how to put this command in a file so it is executed each time the terminal is loaded, even though the defaults should already be very similar.

However, even though you mention carriage return, I think you simply mean that ^C isn't being inserted after you press Ctrl+C.

This happens when the -echoctl option of stty is set: see the full list of options at the Ubuntu manpage for stty. When a - is appended before an option, the opposite result occurs- i.e. ctrl is not echoed to the terminal. To see what non-standard options you have, just enter stty and see if -echoctl is listed:

speed 38400 baud; line = 0;
eol = M-^?; eol2 = M-^?; swtch = M-^?;
ixany iutf8
-echoctl

To temporarily change the setting, so that ^C is echoed when you hit Ctrl+C you can run:

stty echoctl

However, to set it 'permanently', you can either place stty echoctl in your .bashrc or .bash_aliases or perhaps, as noted here, you can create a .stty file in your home folder and place the following in your bashrc:

stty $(cat ~/.stty)

Any other customisations can go in .stty as well, say, for example, if you wanted to reassign the stty shortcuts and have different ones from the default values.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.