Re: selective command history

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Can you boil the commands that you don't want included in the history
file to a series of regular expressions such as the following:

   ^cd
   ^ls
   ^rm

If so, you can create a list of these regular expressions in a file,
then use the ~/.bash_logout script to clean up the history:

   # clean up the history list (the cut part strips of history's line numbers)
   history | cut -b8- | egrep -v -f ~/.command_list > ~/history.tmp
   # flush the current history
   history -c
   # load the cleaned-up history ready to be written out on exit
   history -r ~/history.tmp
   # remove the temporary file
   rm -f ~/history.tmp

You might also want to remove the comments and combine some of the
above commands onto one line with the ";" separator to avoid some
extra history clutter.

-- 
Andy

The only person to have all his work done by Friday was Robinson Crusoe
-- 
users mailing list
users@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe or change subscription options:
https://admin.fedoraproject.org/mailman/listinfo/users
Guidelines: http://fedoraproject.org/wiki/Mailing_list_guidelines


[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux