How to auto-close the terminal after a certain period of inactivity

In today's article, I will show you a little trick to close the terminal automatically after a certain period of inactivity. The trick is very simple, just use any text editor ( as root) to open the file /etc/profile, in Ubuntu or Linux Mint Cinnamon, the command will be:
 sudo gedit /etc/profile  

Once the file is open, just append the following lines to the end of the file:
 TMOUT=seconds  
 export TMOUT  

Change the "seconds" in the variable part of TMOUT to any number you prefer, this is the maximum idling time the terminal can last before getting closed. I will use 200 as the example here, just add the lines into the end of the file /etc/profile like this:

auto-close the terminal after a certain period of inactivity

Then save the file and close the text editor.  After that, run the following command to apply the new change and your terminal will be automatically closed after 200 seconds of inactivity:
 source /etc/profile  
linux tips and tricks