17 ms·
Show HN: History suggest box for your shell
- adder46 6y agohstr-rs is a shell history suggest box that provides quick access to the commands in your shell history. Just search for the command you want to execute (regex mode is supported), or, if you don't precisely know what you're looking for, you can browse through the commands until you find the one you want to execute. Apart from this, you can delete unwanted entries from your history, too, and more. It should work on all terminals ranging from linux term to xterm. It was initially made for bash but it should work as well with zsh, ksh, and tcsh, too. I use it on a daily basis. Check out the README for instructions if you want to try it out. Suggestions, bug reports, etc. are welcome. Let me know what you think: https://github.com/adder46/hstr-rs https://github.com/adder46/hstr-rs
- wheybags 6y agoSmall mistake in the readme > hstr is shell history suggest box. Like hstr, but with pages. Should be "hstr-rs is shell..." I presume? Looks like a nice project :) I'll give it a go. I've often wanted to iterate through options when ctrl-r ing in bash (not saying there isn't a way to do that, but if there is I don't know it)
- anthonyaykut 6y agoThis looks really cool, I’m going to try it out — by the way, what app/tool did you use to record the screencast?
- turtleofdeath 6y agoHow is this different than reverse-i-search?
- tyingq 6y agoThe full page display of selections seems like the most obvious difference to me.
- Galanwe 6y agoNone. But seems like the trend of the last 10 years is to rewrite every single already existing Unix tool in Rust or node.js. Throwing out code is more fun than reading man pages I guess. This saddens me. It looks like the average dev in 2020 believes he needs to pollute his working environment with thousands of seemingly useless tools to be productive. fzf, silver searcher, ripgrep, etc. I will be downvoted to hell, because these people genuinely believe they need these tools, and will find whatever performance or feature argument to explain why. But from my experience, I am much faster at any command line task than pretty much anyone using these fancy stuff, even though I stick to bash, vim, and coreutils...
- kbd 6y agoYou should see my git aliases that makes heavy use of fzf. It definitely speeds me up. `ga` gives an fzf-powered selection only on files in my git status to `git add`. I can cherry pick commits without ever typing a branch or commit hash. Fuzzy-find on reverse search with fzf is way better than the built-in ctrl+r. ripgrep is way better than grep. I could go on. I appreciate your call to be familiar with the core unix experience, but the unix userland is definitely enriched by these newfangled tools.
- sushisource 6y agoThe standard tools have a lot of cruft. `grep` being case sensitive by default is I think a good example of a default that used to make sense, but is probably better the other way around today. There are countless other such examples. Your comment reads as a no-true-scottsman "look how skilled I am" signaling device. You're not necessarily wrong, but you're also clearly fighting a pointless battle, and sound a bit out-of-touch. Yes, the tools already exist and work. No, they do not need to be re-written, but the new versions are often substantially more usable and newcomers enjoy that. Such is the nature of life. Things change. Accept that and you'll be happier. Your attitude might win some points with other fight-the-tide-till-my-last-dying-breath types, but it reads to me as "It is the children who are wrong!" I worked with a guy who had the same attitude about always using kubectl over the gui because it was "faster". He was demonstrably slower at quite a few common tasks, like discovering errors in logs across many pods, than others who used the gui.
- SmellTheGlove 6y agoThis is pretty cool. I'm always mashing the up arrow, so I installed this in anticipation of making my life easier :) I didn't have `cargo` or any other rust language support installed. However, that seems pretty straight forward: https://www.rust-lang.org/tools/install https://www.rust-lang.org/tools/install You may want to throw that into the README. Anyhow, I'm running this on WSL2/Ubuntu 20.04 using zsh + ohmyzsh. It installs cleanly, and I just added `alias hh=hstr-rs` to ~/.zshrc as the only additional step. Works nicely!
- wh33zle 6y agoIf you want to keep your zshrc "clean" you can add any number of individual scripts to `~/.oh-my-zsh/custom` and they will be executed for every new shell.
- SmellTheGlove 6y agoOh that's good to know. For someone my age, I have embarrassingly little knowledge of shell customization. I just looked in .zshrc and there was a comment to the effect of "Add your aliases below, e.g. ALIAS blah=foo" and so I listened to it!
- wh33zle 6y agoThere is nothing inherently wrong with putting them into .zshrc! The reasons I keep them separate is because: a) I can simply backup the `custom` directory and restore onto a "vanilla" oh-my-zsh installation b) I can use descriptive file names which would otherwise have to be comments Also, some software likes to append stuff (like adding directories to PATH) to .zshrc upon installation so it gets kind of messy over time. I guess the comment is from the plain zsh installation and oh-my-zsh just didn't remove it.
- wh33zle 6y agoThis looks cool! I personally use fzf [0] for a similar functionality. It brings fuzzy-search to a lot of aspects of the shell, like reverse search but also autocompletion of `kill` for example. [0]: https://github.com/junegunn/fzf https://github.com/junegunn/fzf
- psutor 6y agoI was about to comment that this kinda looks like fzf + ncurses.
- donquichotte 6y agoSame here. With fzf, you don't search - you find. One of my most powerful bash aliases is alias fzubl='fzf -m | xargs subl'
- atorodius 6y agofzf for the win. It’s such a boost of productivity. Everyone who spends significant amount of times in the shell should try it.
- keyle 6y agoGood idea and fairly easy to implement from .bash_history. I never thought of it myself so I must be content with reverse search and grepping through bash history. One suggestion would be to make it a homebrew recipe for macOS and the Linux version. It would then see a lot more adoption (even if the alias has to be set manually which is fine as it's personal). I'd install it instantly (and probably forget about it for a month).
- personjerry 6y agoIn case you didn't know, bash has a basic version of this already embedded. You can search your bash history from the command line with Control+R (not Cmd+R even for Macs).
- chriszhang 6y agoYes. ZSH has this too. I think the basic shell features can go a long way.
- SmellTheGlove 6y agoTotally, but the dropdown the rest of the height of the terminal is the feature I'm appreciating here.
- angrais 6y agoHow does this differ from peco [1]? [1]: https://github.com/peco/peco https://github.com/peco/peco
- villgax 6y agoctrl-r & fuck have been more than enough for me most of the time