I go one big step further than this and log everything that comes across the screen. One time it saved me from a crontab -r that wiped out a 100+ line crontab. I had viewed it recently so I just copied it out of my history. On a day to day basis it's more about looking up old queries I typed out, the results of those queries at that time, bash commands and their results, the state of a file I edited at a certain time…
How do you do this?
How and Why to Log Your Bash History
71–80 of 139 posts
Re: How and Why to Log Your Bash History
#72Re: How and Why to Log Your Bash History
#73Earlier quoted context omitted.
Dropping the ls, ok. But cd conveys relevant context. It would be really clever if a series of cd/ls rolled into a final absolute path cd so history shows context for the subsequent batch of commands.
If you find yourself doing a series of `cd` and `ls` commands frequently, I feel like you might be using `cd` and tab completion ineffectively. Instead of doing: ls cd foo/ ls cd bar/ ls cd baz/ You can do: ls cd foo/ bar/ baz/ This isn't what it will look like, it's just the key sequence (if this doesn't make sense let me know and I'll try to explain better). will list all the possible completions, which is equivale…
How do I escape asterisk on HN? :O
Re: How and Why to Log Your Bash History
#74I used to do the same thing to figure out which commands I should create short aliases for. Sounded like a good idea at the time but then I realized that I'm creating a file with an awful lot of interesting information in it and I not getting a lot in return. So I set my HISTSIZE to 1000 which is more than enough for interactive shell use and I don't have to worry about having stuff like "youtube-dl fuckmesilly.com/$…
Re: How and Why to Log Your Bash History
#75I'm a big fan of saving history - trying to remember all the shell based commands we use is a nightmare! If you're using zsh, a tip I picked up from [0] was to alias all your common commands like 'cd', 'ls' 'fg'... to: ' cd' ' ls' ' fg' ... Then add the following line to your zshrc to ignore lines prepended with a space: setopt HIST_IGNORE_SPACE This keeps your history cleaner from any ls, cd, fg inputs you use. [0]…
Re: How and Why to Log Your Bash History
#76Earlier quoted context omitted.
If you find yourself doing a series of `cd` and `ls` commands frequently, I feel like you might be using `cd` and tab completion ineffectively. Instead of doing: ls cd foo/ ls cd bar/ ls cd baz/ You can do: ls cd foo/ bar/ baz/ This isn't what it will look like, it's just the key sequence (if this doesn't make sense let me know and I'll try to explain better). will list all the possible completions, which is equivale…
Tab autocomplete will show everything, and showing a screen full of name is not particularly useful. Most of the time I use ls it's something like "ls (asterisk)foo(asterisk)". How do I escape asterisk on HN? :O
Re: How and Why to Log Your Bash History
#77Re: How and Why to Log Your Bash History
#78Re: How and Why to Log Your Bash History
#79Earlier quoted context omitted.
If you find yourself doing a series of `cd` and `ls` commands frequently, I feel like you might be using `cd` and tab completion ineffectively. Instead of doing: ls cd foo/ ls cd bar/ ls cd baz/ You can do: ls cd foo/ bar/ baz/ This isn't what it will look like, it's just the key sequence (if this doesn't make sense let me know and I'll try to explain better). will list all the possible completions, which is equivale…
Tab autocomplete will show everything, and showing a screen full of name is not particularly useful. Most of the time I use ls it's something like "ls (asterisk)foo(asterisk)". How do I escape asterisk on HN? :O