Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I've noticed that in some distributions, or even some versions of distributions, pressing Ctrl-C at the bash command prompt either results in ^C being echoed, or not. I've been looking in "man bash" for a setting that would affect that (it doesn't apply when outside of bash, so I presume it is just something bash does or has set) but cannot find it. Anyone know what to do in bash to change this? If it matters, I want to turn it off where it is on.
Click here to see the post LQ members have rated as the most helpful post in this thread.
I think this behavior can be controlled with the stty command.
I thought so too, netsearched for how and experimented a little but did not come up with an answer. I have noticed that when a script or a loop entered at the command prompt is running and Ctrl+C is used, then ^C is displayed.
I thought so too, netsearched for how and experimented a little but did not come up with an answer. I have noticed that when a script or a loop entered at the command prompt is running and Ctrl+C is used, then ^C is displayed.
Code:
c@CW8:~$ while true; do sleep 1; done
^C
There are a couple of different situations here. If you hit the interrupt character while a program is running, the Linux kernel tty driver will echo "^C" (assuming you are using the default setting of "stty intr", which is ^C) if "stty echoctl" is set. Note that this did not work before kernel 2.6.25, so depending on the version in your Linux distro, you may or may not see this fix (but make sure you have "stty echoctl" set, or you will not see "^C" in any case).
If you hit ctrl-C on the bash command line, however, it is bash's readline code that will echo "^C". This is new bash behavior was introduced in bash 4.0. In bash 4.1, a setting was added to control this readline feature: "echo-control-characters". So putting "set echo-control-characters off" in your .inputrc file will suppress "^C" echo on the bash command line (if using bash 4.1 or later).
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.