- zsh-autosuggestions
history | fzf
alias cat="bat --plain --theme=gruvbox-dark"
You have to be a linux user to use the console now?
Ctrl R
I just use mcfly
Not sure I understand the point of mcfly. zsh and fish have this functionality built in, where pressing Up with a command partially typed will give auto-completions to that partial match.
The number of people who don’t reverse-I-search is too damn high
It was quite a while before I realised that was possible.
Then not long after starting to use it, that I got fed up and just started opening up the history file and searching in it.CTRL+R for those unitiated
reverse-i-search + fzf = <3
cat ~/.bash_history | grep
Useless use of cat?
You saying I can just skip cat in that command and it works?
history | grep 'cat'
My output was empty for that command.
Guess why?
Becausehistory
only gives the last few lines in my system.
grep ~/.bash_history
How did I not know this. Thank you!
it’s
grep STRING FILE
to be preciseor
awk '/STRING/′ FILE
if you prefer that for some reason
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.
So how well you know which command it is of you won’t recognize it when you see it…
Not if you have fzf you don’t: https://github.com/junegunn/fzf
Like an interactive fuzzy finding history. It’s sick.
…until you press up one too many times and enter the same command but with a typo. Again.
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
Been there, done that.
I’ve been using
ctrl + R
more now :3… though I definitely used to ↑↑↑↑↑↑↑check out fzf (install fzf and add (assuming bash)
eval "$(fzf --bash)"
to your .bashrc) Makes ctrl+r a superpowerIt’s awesome until you want to put the cursor in a specific spot of a previous command.
$ rm -f delete-me.txt ctrl-r "me", ctrl-b, ctrl-k $ rm -f delete
But I still use fzf because while I used to do the above, fzf offered more advantage that made switching worth it.
I’ll try it if I don’t forget it by the next time I have access to my PC lol :3
Ctrl + r with fzf and you’ll never go back.
I feel like there should be a cursed “long way round” for this that involves needlessly copying .bash_history to a “text file”, running it through an asciibetical sorter (for “efficiency”), using sed to null out any command which doesn’t match the search term…
^r
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.
and whenever you forget to sudo:
sudo !!
You need this: https://github.com/nvbn/thefuck
I knew there was an
ls
In there somewhere
Now I don’t have to type that in again. Phew!
ctrl + r, l, s
Much faster than simply typing
ls
!ls … enter ↑ enter ↑ enter
You may consider using
watch ls
I’ve probably done that for
ls
Too many people still use Bash.
I like zsh on mac because pretty colors
Too many distributions still ship with Bash.
In the real world, the only thing better than perfect is standardized.
Yeah, true. But, it’s easy to change.
Bash is the Internet Explorer of shells. It’s great for installing a more useful shell.
That’s super unkind and incorrect. IE was a trash software that was widely available because MS was trying to extend their monopoly into new areas.
Even if it’s not your taste, bash is a mature, stable FLOSS package with wide community support. The reason it is so common is due to it’s positive attributes, not because there is a plot to make it the only choice available to you.
Bash might be better than IE. But I think we can agree that it is no longer a good shell.
Its syntax is awful, and lacks many features that other shells have.
It is only so widely used because it is a de facto standard. If bash was created today, barely no one would us it.
That’s not true. Internet Explorer was fucking useless for scripting together things, unlike bash.
Internet Explorer shell expansion always trips me up.
What shell do you recommend?
I like zsh, but some people say great things about fish.
My problem with those is bash is always there and just works.
Yes, just like Internet Explorer.
It’s good to know how to do things in bash, since you’re going to encounter it pretty often. But, that doesn’t mean you shouldn’t customize your shell on the machine(s) you use most often. Why stick with the default when there are better options? You’re just hobbling yourself.
history | grep then !cmd no