Linux Servers Shell Terminal Execute Commands at Logout Introduction It can sometimes be useful to run commands when logging out, such as disconnecting a VPN or similar tasks. Usage Here's an example that you can put in your .profile file: 1trap cmd 0