I noticed a couple of issues with killing console programs
on my linux systems lately. Well issue 1 started bugging me
in the last couple of years, while I've only noticed issue 2
since Fedora 14, and it doesn't happen on my gutsy system at least.
I've not looked at these closely at all, so perhaps someone
knows of a config setting I should be using.
1. Ctrl-C prints ^C
Printing ^C just mangles output that I very often want to read
or copy/paste. Now I can get bash >= 4.1 to not print ^C
by putting 'set echo-control-characters off' in my .inputrc
But that only works on the bash command line itself, and
doesn't work when I'm running a command (sleep 100, for e.g.).
Now I can get the tty not to echo the control characters
by doing `stty -echoctrl`. However the tty then seems to
send ETX when I hit ^C and gnome-terminal will display
that as , and xterm will output an empty line.
2. Closing an xterm running something through su
will leave the process running in the background.
I noticed this when I closed an xterm running:
sudo tail -f /var/log/message
But one can also see it with just:
su -c 'sleep 100' $USER
You can run this in a separate terminal to monitor the sleep:
watch -n.1 'ps -C sleep -o pid,gid,sid,pgid,ppid,pgrp,tpgid'
Note keeping the same session _and_ same user as with the
following, causes the background process to exit with the xterm:
su $USER --session-command='sleep 100'
I did try setting 'huponexit' and using `su -l` to no avail.
Note also that a work around which does kill everything when
the xterm is closed is to:
sudo gnome-terminal -e 'tail -f /var/log/messages'
Maintained by the ILUG website team. The aim of Linux.ie is to
support and help commercial and private users of Linux in Ireland. You can
display ILUG news in your own webpages, read backend
information to find out how. Networking services kindly provided by HEAnet, server kindly donated by
Dell. Linux is a trademark of Linus Torvalds,
used with permission. No penguins were harmed in the production or maintenance
of this highly praised website. Looking for the
Indian Linux Users' Group? Try here. If you've read all this and aren't a lawyer: you should be!