CTRL + W usually deletes everything until the previous whitespace, so it would delete the whole '/var/log/nginx/' string in OP's example. Alt + backspace usually deletes until it encounters a non-alphanumeric character. Be careful working CTRL + W into muscle memory though, I've lost count of how many browser tabs I've closed by accident...
Shell Tricks That Make Life Easier (and Save Your Sanity)
141–150 of 287 posts
Re: Shell Tricks That Make Life Easier (and Save Your Sanity)
#142One 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
Once you start using CTRL+r, you may find that you never reach for up arrow again.
Re: Shell Tricks That Make Life Easier (and Save Your Sanity)
#143CTRL + W usually deletes everything until the previous whitespace, so it would delete the whole '/var/log/nginx/' string in OP's example. Alt + backspace usually deletes until it encounters a non-alphanumeric character. Be careful working CTRL + W into muscle memory though, I've lost count of how many browser tabs I've closed by accident...
That, and Ctrl-N. No more forest of blank browser windows when using a terminal emulator in a web page!
(Firefox only)
Re: Shell Tricks That Make Life Easier (and Save Your Sanity)
#144Earlier quoted context omitted.
Instead of esc, type ctrl [
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?
Re: Shell Tricks That Make Life Easier (and Save Your Sanity)
#145Earlier quoted context omitted.
Once you start using CTRL+r, you may find that you never reach for up arrow again.
I'm familiar with ctrl-r, but I still very much like the up-arrow behavior described by that commenter.
"I typed 'cd di↑' and you're giving me 'pwd'??"
Re: Shell Tricks That Make Life Easier (and Save Your Sanity)
#146Earlier quoted context omitted.
> This weird command is presented with such a benevolent innocence as if it's the simplest thing in the world. I think it's a question of context and familiarity. To a vim user, like me and, I assume, ahmedfromtunis, their examples do indeed seem simple and natural. Presumably, to an emacs user, the example you quote (if it's quoted literally—I don't use emacs and can't even tell) is just as natural, and assuming som…
> assuming some comfort with emacs is presumably OK in a manual for the software! How do you get familiar with the software, if the manual expects you to be an expert in it already?
Re: Shell Tricks That Make Life Easier (and Save Your Sanity)
#147Re: Shell Tricks That Make Life Easier (and Save Your Sanity)
#148set -o vi puts you into vi mode at the cli prompt with all the semantics of the editor. These carpal tunnel riddled hands can’t be bothered to reach for ctrl or alt let alone arrow keys.
Re: Shell Tricks That Make Life Easier (and Save Your Sanity)
#149I've been using a lot of key combinations and I wasn't aware of these two, and I really think these are awesome additions to handling the console. Thank you for showing me. I've only been using it for 22 years, but I haven't come across these :D `CTRL + U and CTRL + K CTRL + W` What I like about these key combinations is that they are kind of universal. A lot of programs on Linux and Mac support all these key combina…
Notably, these keybindings are it's default map, which comes from the GNU's project editor Emacs. But, there is also the POSIX-compliant, but not-default, editing mode based on Bill Joy's visual editor (vi).
Re: Shell Tricks That Make Life Easier (and Save Your Sanity)
#150Earlier quoted context omitted.
My biggest complaint about the fish shell is the lack of true vi mode. They attempt to emulate it and it works to some degree, but it's no comparison to readline's implementation.
What is it lacking in your eyes that makes it not true? I find fish’s vi mode more ergonomically complete for things like editing multi-line commands