.bash logout

From Linux Shell Scripting Tutorial - A Beginner's handbook
Revision as of 22:50, 29 March 2016 by Admin (talk | contribs) (Text replacement - "</source>" to "</syntaxhighlight>")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

This is the individual login shell cleanup file, executed when a login shell exits. This file exists in users home directory i.e. $HOME/.bash_logout. This is useful if you want to run task or another script or command automatically at logout. For example, [clear the mysql command line] history stored in ~/.mysql_history or make backup of files you can use this file.

Sample $HOME/.bash_logout file

clean
# clear history
/bin/rm $HOME/.mysql_history

# Backup files to NAS server
~/bin/backup.sh