0

I'm using Kubuntu 14.04. When I exiting terminal emulator (konsole or yakuake) by doing something like kill -9 $$ it doesn't close, and saying:

Warning: Program '/bin/bash' crashed.

How could I disable this behavior and force terminal emulator to silently close when shell is killed?

In the same system, when prompting kill -9 $$ in xterm, it exits without any crash reported.

I don't remember exactly, in which Linux distributions I saw such "silent" behavior from-the-box, but there are some.

Update: the reason to do so is to exit terminal emulator without saving history to .bash_history.

8
  • 2
    Why do you want to kill the shell rather than letting it terminate gracefully so it can clean up after itself, eg save its history file?
    – PM 2Ring
    Dec 16, 2014 at 7:41
  • What happens if you send SIGHUP instead of SIGKILL ?
    – PM 2Ring
    Dec 16, 2014 at 7:59
  • My main case to do so is exactly to avoid saving shell history after some crap accidently pasted into open terminal emulator.
    – AntonioK
    Dec 16, 2014 at 7:59
  • 2
    I've just been playing with this stuff in konsole, so I see what you mean. But there's some useful info in How do I close a terminal without saving the history?
    – PM 2Ring
    Dec 29, 2014 at 11:36
  • 2
    As your goal is to avoid history entries, try history -d. As this is a bash built-in, details are in help history. Sep 11, 2015 at 10:37

1 Answer 1

8
+50

Please consider editing /etc/profile. At the bottom add:

unset HISTFILE && exit

for your current session. If wanting all history gone, try:

rm -f $HISTFILE && unset HISTFILE && exit

Killing an app is not the most graceful approach. See Quit Bash Shell Without Saving Bash History (5 Methods). Avoid #2, as this is what you are trying now.

1
  • Thank you, that's solving my issue. So I could now make an alias for bash, something like alias french_exit='unset HISTFILE && exit'
    – AntonioK
    Sep 26, 2015 at 8:44

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .