- cross-posted to:
- programmerhumor@lemmy.ml
- cross-posted to:
- programmerhumor@lemmy.ml
https://github.com/atuinsh/atuin is a great tool to manage and search your shell history. I especially enjoy it being able to search commands based on the working directory I was in when I ran them.
It also has more features (which I don’t use) to manage dotfiles and sync shell history across hosts/devices.
I was going to talk about it too ! Even though I’m on fish (which helps a lot with history search) atuin really changed my habits and made my life easier !
or documentation.To use ctrl-r I have to remember something about the command. To use up arrow I just have to know about how many commands ago I used it.
Not if you have fzf you don’t: https://github.com/junegunn/fzf
Like an interactive fuzzy finding history. It’s sick.
So how well you know which command it is of you won’t recognize it when you see it…
zsh tab completion also looks through history wich is pretty nice.
I’m in this picture, and I didn’t like it…
Substring completion on ZSH. Type in a small part of the command you want to find and then press up.
bash supports this feature too btw
Added to my mental toolbox, thanks!
Featherpad, copy, paste. Extra work, but you get a work log
…until you press up one too many times and enter the same command but with a typo. Again.
Been there, done that.
There is an option you can set in .zshrc or .bashrc which only includes lines that exit 0 (success)
Infuriatingly that would omit things like unit test runners from the history in case they don’t pass. As a developer I tend to re-run failed commands quite often, not sure how widely that applies, though.
Oh, stuff like
git diff
andgit log
will end up being omitted pretty often.
And a lot of times, the commands that end with piping intoless
In
fish
, you can enter part of the command, and then press up to search for it. It’s kinda awesome.yeah I ONLY just recently switched to fish after using zsh and oh my zsh for so long - pretty much since first starting linux cause I once saw someone using it on unixporn and I thought “that’s cool”
when I switched to NixOS zsh with all the plugins was a total slog. switched to fish and it just HAS everything that zsh/oh my zsh and the various plugins had but baked in.
so yeah in Fish it’s just starting to type something and hoping it’s still in the history.
That’s what I do in bash except for pressing up it’s ctrl+r. FZF does the fuzzy finding for me. It’s so convenient.
I wish this wasn’t so painfully true.
Relevant xkcd: https://xkcd.com/1168/
tar --help
tar -xvf <archive-name>
but only because I had to look it up twice so now my brain has committed it to memory
I don’t even know what it doesi just use unar (unarchive) nowadays, since that works with all file formats iirc
Extract a tarball with verbose output from the specified file.
And learn how to use the ‘z’ option
tar - h
Unfortunately that’s not valid.
$ tar -h tar: You must specify one of the '-Acdtrux', '--delete' or '--test-label' options Try 'tar --help' or 'tar --usage' for more information.
From man-page:
-h, --dereference follow symlinks; archive and dump the files they point to
Damn.
Thanks, we all died.
:)
The one people see me doing that gets a “huh?” Is:
~$ !find find -type f -name '*blah*' -print0 | xargs -0 gzip ~$
“Wait! What did you do?” “Oh. Do you not know about bang?”
I love the excitement of using !?
Did I remember correctly what command sequence I last used that pattern with? Will my data be gone? Will I send a vulgar email to my boss? Who knows, let’s find out!
I don’t understand people who have the confidence to just blindly run the last matching command like that. Like, are you 100% sure that the last time you ran find was that one, not the one that piped to
xargs rm
?At least with zsh you can tab to complete the
!find
and verify it’s what you want before running it. And, AFAIK by default, the shell optionhist_verify
is set, so if you do just type!find
and hit enter, it doesn’t run the command, it loads the command into the editing buffer so you can look it over first. Maybe I just have a weak memory, but I really appreciate the footgun prevention. At worst I have to hit enter twice. At best, I save myself a lot of grief.
Oh come on! I at least type the beginning so that it filters the history
I’ve probably done that for
ls
^r
and whenever you forget to sudo:
sudo !!
You need this: https://github.com/nvbn/thefuck
Ctrl-r, l ctrl-r, ctrl-r, ctrl-r, ctrl-r, ctrl-r, ctrl-r, ctrl-r, ctrl-r. To get ls.
No way! I didn’t know you could cycle through the results like that… awesome!
It’s basically emacs incremental search.
O(n) access, very efficient.
No, I do not care to share the value of n