Not a fan of the LLM-flavoured headings, and the tips seem like a real mixed bag (and it'd be nice to give credit specifically to the readline library where appropriate as opposed to the shell), but there are definitely a few things in here I'll have to play around with. One thing I dislike about brace expansions is that they don't play nicely with tab completion. I'd rather have easy ways to e.g. duplicate the last…
Readline is close enough to being part of bash that it’s not really inaccurate to call these all shell features imo.
Shell Tricks That Make Life Easier (and Save Your Sanity)
171–180 of 287 posts
Re: Shell Tricks That Make Life Easier (and Save Your Sanity)
#172Re: Shell Tricks That Make Life Easier (and Save Your Sanity)
#173One thing I find life-changing is to remap the up arrow so that it does not iterates through all commands, but only those starting with the characters I have already written. So e.g. I can type `tar -`, then the up arrow, and get the tar parameters that worked last time. In zsh this is configured with bindkey "^[OA" up-line-or-beginning-search # Up bindkey "^[OB" down-line-or-beginning-search # Down
Re: Shell Tricks That Make Life Easier (and Save Your Sanity)
#174I love this, from a comment on the article: He had in his path a script called `\#` that he used to comment out pipe elements like `mycmd1 | \# mycmd2 | mycmd3`. This was how the script was written: ``` #!/bin/sh cat ```
$ echo foo | tr fo FO | sed 's/FOO/BAR/'
BAR
$ echo foo | ${IFS# tr fo FO | } sed 's/FOO/BAR/'
foo
It's nice to have a way to both /* ... */ and // ...
in shell scripts though: foo \
| bar ${IFS Do the bar. Do it. } \
| baz
* in the best possible way, like it's awful - I hate I didn't think of thatRe: Shell Tricks That Make Life Easier (and Save Your Sanity)
#175Earlier quoted context omitted.
It’s strange. I have heard this from lots of others too. I think I am an anomaly here. I can’t live without shell vi mode
You're not alone, I heavily rely on vi mode and often struggle if I'm on someone else's machine and can't use it. I always wonder how you're supposed to work without it but I never dare to ask
Re: Shell Tricks That Make Life Easier (and Save Your Sanity)
#176Using the terminal becomes much more cozy and comfortable after I activate vim-mode. A mistake 3 words earlier? No problem: 3bcw and I'm good to go. Want to delete the whole thing? Even easier: cc I can even use v to open the command inside a fully-fledged (neo)vim instance for more complex rework. If you use (neo)vim already, this is the best way to go as there are no new shortcuts to learn and memorize.
I've been a (n)vim user for 20+ years now, but I hate vi-mode in the shell. However if I feel that I need to do a complex command, I just do ctrl-x+e to open up in neovim (with EDITOR=nvim set). I find it a good middle ground.
Re: Shell Tricks That Make Life Easier (and Save Your Sanity)
#177Re: Shell Tricks That Make Life Easier (and Save Your Sanity)
#178Is it just me, or is it an LLM language? The article tries very hard to be correct but somehow lacks experience. I've never used the majority of these tricks for decades, except for brace expansion, process substitutions, and complex redirections.
Re: Shell Tricks That Make Life Easier (and Save Your Sanity)
#179Earlier quoted context omitted.
Does it help a lot? You've still got a three to type which is a crime, plus some letters, only to move 3 words. My typing skills are not great, but that sounds like an awful lot of work(?) If I hit CTRL + ARROW_LEFT 3 times, I am done a lot faster I guess. But I am open to learn, do people really use that and achieve the goal significantly faster?
I think it’s a difference in how people think. I can’t remember hotkeys. It just doesn’t compute. But with vim style bindings it’s much closer to writing a sentence. `3`, number of times, `b`, beginning of word, `c`, change, `w`, word. Yea it’s a lot. I cannot explain why it’s simpler for me to learn that than emacs style bindings but it is.
Your Problem with vim is you don't grok vi
https://stackoverflow.com/questions/1218390/what-is-your-mos...
Re: Shell Tricks That Make Life Easier (and Save Your Sanity)
#180What confuses me is that Ctrl+Y "yank" means the opposite of what it means in Vim. Certainly does not help with keeping my sanity.