Live data from Hacker News

“I have [bash] history back to ~2003”

twitter.com

81–90 of 148 posts

Re: “I have [bash] history back to ~2003”

#82
post #77

Earlier quoted context omitted.

Why not? I mean, what's the value of knowing you typed 'ls -l' or 'ps -augx' on December 12th, 2012?

It's moreso for when you spend time crafting the perfect command, and dont' want to repeat yourlself. Example.. 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.

To be fair, if you've built the "perfect" command, it would serve you better to put it in a alias or shell script. That way it will move with you.

Re: “I have [bash] history back to ~2003”

#83

Anybody have the equivalent for fish shell? Or better yet, a config that will consolidate history across terminal tabs?

fish 2.2 ships with `history --merge`:

       · --merge immediately incorporates history changes from other sessions.
         Ordinarily fish ignores history changes from sessions started after
         the current one. This command applies those changes immediately.

Re: “I have [bash] history back to ~2003”

#84

Earlier quoted context omitted.

Another issue is that it looks like would start a new history file only when a new shell is started. Some people log in fresh every day, but I've got terminal windows on my home machine that have been sitting around for many months... I guess you'd have to set the history-size etc large enough to hopefully last for the maximum expected shell run-time. EDIT: hmm, the man page says you can just unset HISTFILESIZE or se…

Yeah, I have this as well: export HISTSIZE=65535 # why not? export HISTFILESIZE=65535 export HISTCONTROL=ignoredups but now I'm wondering if I should unset `HISTFILESIZE` insteead.

It can also be nice to use HISTCONTROL=ignorespace

If you're planning on keeping a lot of history, ignorespace makes it easy to avoid inserting commands with sensitive info. A well-placed $(cat) can work too.

    $  PASSWORD=hunter2 # sensitive info doesn't go into history
    $ curl -O http://name:$PASSWORD@server/path # command with correct syntax does go into history

Re: “I have [bash] history back to ~2003”

#85
post #48

Earlier 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?

It's more the value of "what command and which options did I run 8 months ago to convert data from format x to format y".

You can filter things like ls and ps.

Re: “I have [bash] history back to ~2003”

#86
post #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 |…

You owe the GNU coreutils project $392

https://github.com/diafygi/gnu-pricing

Re: “I have [bash] history back to ~2003”

#87
post #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 |…

You owe the GNU coreutils project $392 https://github.com/diafygi/gnu-pricing

This is actually awesome!

Re: “I have [bash] history back to ~2003”

#89
post #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 |…

On one hand this really seems like overkill. On the other hand, this is incredibly awesome. Thanks for sharing :)

Re: “I have [bash] history back to ~2003”

#90
post #79
post #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 |…

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

You could really do some interesting stuff with this. Automatically recommend aliases and show how many keystrokes you would have saved for example.
Post reply on HN