2

I like to keep a number of terminals open at different locations on my development VM. For this I use terminator because I got a big screen and I can divide the terminals anyway I want.

But after some time these terminals close one after another. I don't use ssh so any keepalive options would not work.

Is there any place where I can configure the terminal so that it does not timeout or close?

I am using GNU bash, version 4.2.37 as shell and terminator on 'xterm`

6
  • 1
    Are you using xterm or terminator? These are 2 different terminal emulators, you can't use one on the other. In any case, terminator does not close automatically, I have terminator windows open for hours if not days in my session. Same goes for xterm, what you describe is very strange. You have probably set something up yourself to do this. What is the output of echo $TMOUT?
    – terdon
    Jan 21, 2014 at 15:38
  • echo $TMOUT gives me xterm ... Jan 21, 2014 at 15:48
  • I have a plain setup of CB on top debian net install nothing fancy and all standard setup, but I got some things set in bashrc, I am going to look through that... Jan 21, 2014 at 15:50
  • Ok it think I found the culprit :-) export TMOUT=600 in .bashrc :/ Jan 21, 2014 at 15:54
  • Sorry I missread your question about echo $TMOUT I actually read echo $TERM cause I just skimmed over it but you are absolutely correct with your assumtion that TMOUT is the culprit. Thanks a lot for the time and help!!! Jan 21, 2014 at 16:00

2 Answers 2

2

What you describe is not the default behavior. The only way I can think of this happening is if you have set the TMOUT variable to something. From man bash:

   TMOUT  If set to a value greater than zero, TMOUT  is  treated  as  the
          default timeout for the read builtin.  The select command termi‐
          nates if input does not arrive after TMOUT seconds when input is
          coming  from  a terminal.  In an interactive shell, the value is
          interpreted as the number of seconds to  wait  for  input  after
          issuing  the  primary prompt.  Bash terminates after waiting for
          that number of seconds if input does not arrive.

In other words, bash will exit automatically in $TMOUT seconds.

So, you need to search for the file where that variable is set and unset it. This is probably going to be in your $HOME/.bashrc file but to be on the safe side, run this command which will search all possible config files for TMOUT:

for f in  ~/.bashrc ~/.profile ~/.bash_profile ~/.bash_login \
         /etc/profile /etc/environment /etc/bash.bashrc; 
do 
  [ -e $f ] && grep -H TMOUT $f; 
done

That should return a line like

/home/terdon/.bashrc:TMOUT=600

Delete that line from the relevant file and you're set.

1
  • 1
    Sorry I missread your question about echo $TMOUT I actually read echo $TERM cause I just skimmed over it but you are absolutely correct with your assumtion that TMOUT is the culprit. Thanks a lot for the time and help!!! Jan 21, 2014 at 16:00
0

Maybe you are disconnected somewhere in the infra.

Open an extra xterm window, and enter

while [ 1 ]; do   /usr/ucb/echo -n .; sleep 40; done

You will get a dot every 40 seconds and enter ^C when you're finished.

3
  • yeah while this would work, it is very hacky. I found the issue though, thanks for the suggestion! Jan 21, 2014 at 21:52
  • Debian has no /usr/ucb? Aug 27, 2015 at 12:40
  • @Alex: You are right, the /bin/echo will do. You just need an echo that doesn't add a newline somehow, with the option -c or with ".\c". echo is not the most portable solution for this, I should have chosen for something like awk. I thought that printf "." was only supported by ksh (not bash), but on Debian it is!
    – Walter A
    Aug 27, 2015 at 21:05

You must log in to answer this question.

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