March 07, 2007

Top tip for unix users

If you do a lot of work from the command line on a unix box, this is the single most useful tip I know. Put this in your .bashrc (adjust to suit if you use a different shell)

export HISTFILE=~/.history/`date +%Y%m%d`.hist

Its effect is to create a new history file every day. Which means that, over time, you build up a complete log of everything you’ve ever done. Meaning that, if you ever find yourself thinking ‘what was that command I ran, last time this broke? Was it something to do with strace ?’ , you can just do ‘grep strace ~/.history/*’ and find the answer.

Setting HISTSIZE to something large like 100000 is a good idea, too, so that you capture everything. I’ve got about 6 months worth of history now, and it amounts to about half a MB – so not likely to cause a problem storage-wise. And it’s been a life-saver several times over already.


- No comments Not publicly viewable


Add a comment

You are not allowed to comment on this entry as it has restricted commenting permissions.

Trackbacks

Most recent entries

Loading…

Search this blog

on twitter...


    Tags

    Not signed in
    Sign in

    Powered by BlogBuilder
    © MMXII