Skip to content
Advertisement

How to clear terminal window after TMOUT

I want to see if there is a way to have the terminal windows cleared after a TMOUT session timeout and disconnect. Does anyone know of a way to have the screen cleared once it times out?

Advertisement

Answer

Set an exit trap in your .bashrc file

trap '[[ -n $TMOUT ]] && clear' exit

When the shell exits, it executes the clear command if TMOUT is set to a non-null value.

User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement