Hello Geeks!
Is been a long time I wrote about something tricky and geeky. Today am going to show you how to quit or exit terminal after a specified time of inactive.
Well, Let’s get started.
Press Ctrl+Alt+T to Open terminal
Run the command below to edit the file /etc/profile using gedit (input password when prompted):
$ sudo gedit /etc/profile
Append the codes below to the opened file.
# Exit Terminal TMOUT=600 export TMOUT
Understanding the codes above:
TMOUT: In other words TiMeOUT is the specified time in seconds when the Terminal should be closed. Here I have set it to 600 seconds (equal to 10 minutes. That is 600/60)
#Exit Terminal: This straight forward and clear. It says close terminal after the specified time TMOUT.
Now save the file. After saving the file, run the command below to effect changes without closing or logging off:
$ source /etc/profile
NOTE: The terminal will only be able to quit after the specified time, after running the command above anytime you wish.