jump to navigation

In Unix, how can I get a command to execute when I log out? November 21, 2010

Posted by Tournas Dimitrios in Linux.

If you use the csh, tcsh, or Bash shell, you can create a file in your home directory that contains commands that you want executed when you log off (i.e., immediately after you enter exit or logout).

If you use csh or tcsh, create a file called .logout. If you use bash , create a file called .bash_logout. In the file, put the commands you wish to have executed upon logging out.

Use this feature with care. If your .logout> file is lengthy or contains errors and you leave a public terminal before verifying that the file is done executing, an unscrupulous user could gain access to your account by interrupting its execution.

This function is distinct from cron, which can perform actions at particular dates and times while you are logged out.



No comments yet — be the first.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s