LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Append bash history to another file during logout (https://www.linuxquestions.org/questions/linux-newbie-8/append-bash-history-to-another-file-during-logout-4175544717/)

shipon_97 06-07-2015 07:24 AM

Append bash history to another file during logout
 
Hi friends ,

I am using Redhat Linux 5.6 . I want to delete all my 'history' command information during logout , but before deleting it copies to a new file .
Also , each time of logout , it appends the new history command of that particular new file .

Is anybody help me to do this ?

jmgibson1981 06-07-2015 09:05 AM

Code:

man history
In the case of current Ubuntu Server the command you would want would be something like this. I'd imagine RedHat would be similar but the man command will tell you what you want specifically.

Code:

cat ~/.bash_history >> yourfile
rm ~/.bash_history


shipon_97 06-08-2015 01:00 AM

Thx jmgibson ,

But I want to append the output during logout time .
Also I want to add date i.e., ' HISTTIMEFORMAT' with the .bash_history output .

pan64 06-08-2015 02:09 AM

there is a ~/.bash_logout file, see man bash about its usage. Probably that's what you need.

shipon_97 06-08-2015 02:31 AM

Thx all for help me .


All times are GMT -5. The time now is 02:26 PM.