Here's something interesting - We collected bash history of around 15000 users and listed frequented used commands for fun :) http://www.webminal.org/fulc/
Doing this on my own bash_history is what prompted me to create autojump.
“I have [bash] history back to ~2003”
71–80 of 148 posts
Re: “I have [bash] history back to ~2003”
#72bash history had never seemed to work for me between tmux windows. Commands are 'trapped' in their respective window and the last one to close 'wins' and writes its history over the others. So I end-up with never-closing task-based window sessions and occasionally copy-paste commands to a safe file for future reference. I really should investigate the root cause some day...
A much better system would be to have a user daemon centralize history (among other things). The benefits would be numerous:
- Better performance
- (optional) Sync between concurrent shells
- No history overwriting problems / race conditions
In addition, this daemon could be used to enable other programs such as autojump. These programs work with the current system, but are based on a hack and as such have needlessly poor performance.
Re: “I have [bash] history back to ~2003”
#73 $ history | wc -l
56201
I use a simple prompt_command hook to push my history (from all my machines) to a central MySQL database(https://github.com/fredsmith/history-db). Entries are de-duped and a tally is kept so I can do simple ad-hoc reporting: mysql> select * from history order by count DESC limit 10;
+-------+---------------------+-----------+----------+-------+
| id | timestamp | command | hostname | count |
+-------+---------------------+-----------+----------+-------+
| 1 | 2015-09-02 19:41:45 | ls | xicada | 34458 |
| 89 | 2015-09-02 14:58:33 | cd .. | xicada | 4332 |
| 519 | 2015-08-24 18:38:55 | ll | xicada | 3229 |
| 9 | 2015-09-02 12:37:05 | cd | xicada | 2250 |
| 82 | 2015-08-28 18:27:07 | add | xicada | 1887 |
| 329 | 2015-08-31 18:22:49 | gs | xicada | 1817 |
| 48 | 2015-09-02 19:17:26 | git pull | xicada | 1696 |
| 275 | 2015-08-24 18:23:44 | df -h | xicada | 1529 |
| 15708 | 2013-10-08 01:33:33 | grid unn1 | Europa | 1210 |
| 44 | 2015-08-31 13:10:46 | git push | xicada | 1139 |
+-------+---------------------+-----------+----------+-------+
10 rows in set (0.02 sec)
It's pretty useful (I search through my history constantly with ctrl-R or using bash's history-search-backward hotkeys), and having a 56K line history file doesn't seem to impact history searching or shell startup any noticeable amount.Re: “I have [bash] history back to ~2003”
#74bash history had never seemed to work for me between tmux windows. Commands are 'trapped' in their respective window and the last one to close 'wins' and writes its history over the others. So I end-up with never-closing task-based window sessions and occasionally copy-paste commands to a safe file for future reference. I really should investigate the root cause some day...
Re: “I have [bash] history back to ~2003”
#75I wish I had bash history that long. Never seems to have the command I want when I look for it.
I think it's better to simply learn the commands than to have a tremendous amount of history logged. If you have to type a lot of command parameters a lot you can always automate that with aliases anyway.
Re: “I have [bash] history back to ~2003”
#76Earlier quoted context omitted.
Why?
Why not? I mean, what's the value of knowing you typed 'ls -l' or 'ps -augx' on December 12th, 2012?
Also means you don't have to retype complicated commands too often.
Practical example: I remember I cleaned up some calibre converted epubs with perl a couple months ago, because they had a piece of text injected by some kind of generator on every page. It took me some time to figure out the exact replacement patterns, and if I were to do it again, I just need to do:
$ history 0 | grep perl ... 823 perl -0777 -i.original -pe 's#Generated by ABC Amber LIT Convhttp://www.processtext.com/abclit.html" class="calibre2">erter,
\nhttp://www.processtext.com/abclit.html\n class="calibre3">##g' part1.xhtml 825 perl -0777 -i.original -pe 's#Generated by ABC Amber LIT Convhttp://www.processtext.com/abclit.html" class="calibre2">erter, \nhttp://www.processtext.com/abclit.html\n class="calibre3">##g' *.xhtml ...Then inspect the history around those commands to find exactly how I got to that point.
Re: “I have [bash] history back to ~2003”
#77Earlier quoted context omitted.
Why?
Why not? I mean, what's the value of knowing you typed 'ls -l' or 'ps -augx' on December 12th, 2012?
find . -type d -print0 | sort -z | xargs --null -I '{}' du -sh '{}' | sort -h
Simple and clear; but history gives you the convenience to do find and having the command run with out parameter/typo verification.
Re: “I have [bash] history back to ~2003”
#78Re: “I have [bash] history back to ~2003”
#79$ history | wc -l 56201 I use a simple prompt_command hook to push my history (from all my machines) to a central MySQL database( https://github.com/fredsmith/history-db ). Entries are de-duped and a tally is kept so I can do simple ad-hoc reporting: mysql> select * from history order by count DESC limit 10; +-------+---------------------+-----------+----------+-------+ | id | timestamp | command | hostname | count |…
Re: “I have [bash] history back to ~2003”
#80$ history | wc -l 56201 I use a simple prompt_command hook to push my history (from all my machines) to a central MySQL database( https://github.com/fredsmith/history-db ). Entries are de-duped and a tally is kept so I can do simple ad-hoc reporting: mysql> select * from history order by count DESC limit 10; +-------+---------------------+-----------+----------+-------+ | id | timestamp | command | hostname | count |…
I'd be quite interested in someone provided this sort of thing as a SaaS-like drop-in to Bash and Zsh if someone wants a fun weekend project..
I'll see what I can do for a hosted/SaaS system this weekend.