Re: selective command history

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

 



On 17 September 2010 12:45, Andy Blanchard <zocalo@xxxxxxxxx> wrote:
> 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:
>

This is an excellent idea! I'll give this a shot. Coming up with the
proper regex shouldn't be too difficult.

>   # 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.
>

Thanks a lot Andy. Much appreciated. :)

> --
> Andy
>

-- 
Suvayu

Open source is the future. It sets us free.
-- 
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]     [Older Fedora Users]     [Fedora Announce]     [Fedora Package Announce]     [EPEL Announce]     [EPEL Devel]     [Fedora Magazine]     [Fedora Summer Coding]     [Fedora Laptop]     [Fedora Cloud]     [Fedora Advisory Board]     [Fedora Education]     [Fedora Security]     [Fedora Scitech]     [Fedora Robotics]     [Fedora Infrastructure]     [Fedora Websites]     [Anaconda Devel]     [Fedora Devel Java]     [Fedora Desktop]     [Fedora Fonts]     [Fedora Marketing]     [Fedora Management Tools]     [Fedora Mentors]     [Fedora Package Review]     [Fedora R Devel]     [Fedora PHP Devel]     [Kickstart]     [Fedora Music]     [Fedora Packaging]     [Fedora SELinux]     [Fedora Legal]     [Fedora Kernel]     [Fedora OCaml]     [Coolkey]     [Virtualization Tools]     [ET Management Tools]     [Yum Users]     [Yosemite News]     [Gnome Users]     [KDE Users]     [Fedora Art]     [Fedora Docs]     [Fedora Sparc]     [Libvirt Users]     [Fedora ARM]

  Powered by Linux