10 ms·
When I was first programming and into UNIX it was the norm amongst those I was learning from that you'd symlink your history file to /dev/null This had a few a
by nikcub 10y ago
When I was first programming and into UNIX it was the norm amongst those I was learning from that you'd symlink your history file to /dev/null
This had a few advantages which might not be immediately apparent. The most obvious is that you remove the risk of leaking private or sensitive data.
The second is that searching your history is an anti-pattern. If there is a command you can't remember, or if there is a group of commands you need to accomplish a task, you should be writing shell scripts
My ~/bin folder has 104 files in it[0] and is in git, is available wherever I log in, whichever tty I have open and has a much better taxonomy than 'search for part of command' based on doing tasks. The same can't be said for history files.
[0] at its peak when I was a BSD and RHEL user it would have been more files but i've recently switched to Alpine.
- pvaldes 10y agoThe problem with history is that records all your activity and is a big snitch. On the other hand you will not want to save in your database repeated or trivial commands like "ls ." normally. You can have the best of both worlds if you configure its behaviour in bash. Any command that starts with a space is still successful but will be discarded in bash history. As "internet is for porn" could be useful to delete any video viewer entry automatically. (Add some lines like: "alias vlc=' vlc'" in your .bashrc). History can be also configured to save only one copy of duplicated commands. If you have a sensible or difficult to memorize command the best is to put it in a script, not in a db.
- __david__ 10y agoI like that as a concept, except it doesn't even go into local history (up arrow), which makes the feature so frustrating for me that I ended up turning it off. Too many times I copy and paste something and end up with a little extra whitespace at the beginning. I guess the number of times I've done it on purpose was dwarfed by the number of times I did it on accident, and that killed it for me.
- alphapapa 10y agoTo a point you have a point, but there is a point at which your ~/bin becomes unwieldy. I have 386 commands in mine, and for commands I don't use very often, I tend to forget their names, or that they even exist. So searching my fish history with Percol can be much faster than trying to remember the specific, hyphenated name I gave to the script I wrote a year ago. I also have a `~/.savedcommands` file that I save one-liners to with a comment at the end, and `C-s` at the prompt loads that file into Percol, so I can search these more easily than searching the entire shell history. `savelastcommand` saves the last command to this file, or `savecommand COMMAND` does the same thing.