对于Linux新手来说,好不容易搜索到了一个命令xxx,过几天却忘了,想查下history | grep xxx | wc -l为0。
索性把所有命令都记录下来~
Debian lenny下,gnome-terminal记录历史shell命令的一种方法。
bash
1 echo HISTSIZE=2000 >> ~/.bashrc
2 echo HISTFILESIZE=2000 >> ~/.bashrc
3 echo HISTTIMEFORMAT="%Y-%m-%d %H:%M:%S " >>~/.bashrc
4 echo alias exit='history >> ~/.bash_history_all;sort -u -k 2 -k 3 -k 1 ~/.bash_history_all -o ~/.bash_history_all;exit' >> ~/.bashrc
5 source ~/.bashrc