I'm running gnome in a VM. I leave the VM up all the time, even when I sign out of VNC. Lately I have noticed when I come back in the next morning all the terminal windows I had open have closed, presumably due to timing out after a night of inactivity.

I want to prevent this from happening. I find it annoying to reopen and position my terminals. more importantly checking what is on my terminals is one of the things that helps me remember what I was doing when I had to log off the night before. How can I prevent them from closing?

  • Are you sure that the VM stays up? You can probably check with uptime. – NickD Mar 20 '18 at 15:00
  • @Nick Yes. My spacemacs windows all stay open. In addition one terminal window, the one that is usually actively running the program I'm testing, stays open. I lose all the terminals not actively running applications though. – dsollen Mar 20 '18 at 15:45
  • Check the journal to see if there's a mention of any cleanup routines closing idle programs. sudo journalctl -b | grep -i "terminal" should filter to the terminal emulators since boot. – Mio Rin Mar 20 '18 at 15:58
  • The shell can have an idle timeout set, for example env variable TMOUT is the number of seconds to wait for a command in bash. – meuh Mar 20 '18 at 18:00
  • @meuh It looks like that was the problem. I've unset it in my .bashrc, I'll have to wait until tomorrow to see if that worked. If you want to post this as an answer I'll accept it if that turns out to work :) – dsollen Mar 20 '18 at 21:34

The bash, ksh, and zsh shells all interpret the environment variable TMOUT, if set to a positive integer, as the maximum number of seconds to wait for a command in an interactive shell before exiting due to idleness. They issue a warning message, but you will not see it as your terminal will disappear. ksh seems to provide an extra 60 seconds after the warning.

The same variable is used to set the default timeout for read and select in bash scripts.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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