In this tip, we will see how to force the terminal to close after n seconds of inactivity (idle). I tested this tip in Ubuntu 12.10 and may work in older versions of Ubuntu and this includes Linux Mint.

Getting Started

Open the terminal and edit /etc/profile with this command:

sudo gedit /etc/profile

At the end of the file, enter these lines:

# Exit Terminal
export TMOUT

In TMOUT, I have set the terminal to exit after 900 seconds (15 min), set your own time in seconds. After saving your file, run this command to apply the new changes without the need to log out and log back in:

source /etc/profile