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)
31–40 of 287 posts
Re: Shell Tricks That Make Life Easier (and Save Your Sanity)
#32Re: Shell Tricks That Make Life Easier (and Save Your Sanity)
#33One trick I use all the time: You're typing a long command, then before running it you remember you have to do some stuff first. Instead of Ctrl-C to cancel it, you push it to history in a disabled form. Prepend the line with # to comment it, run the commented line so it gets added to history, do whatever it is you remembered, then up arrow to retrieve the first command. $ long_command $ #long_command $ stuff_1 $ stu…
Re: Shell Tricks That Make Life Easier (and Save Your Sanity)
#34Using 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.
Re: Shell Tricks That Make Life Easier (and Save Your Sanity)
#35I 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 ```
#!/bin/sh
$*
that's my `~/bin/noglob` file, so when I call a zsh script from bash that uses `noglob`, it doesn't blow up.Re: Shell Tricks That Make Life Easier (and Save Your Sanity)
#36Re: Shell Tricks That Make Life Easier (and Save Your Sanity)
#37I tried this in zsh and it wasn't the default behaviour which immediately made me nope from the shell altogether, among all the other quirks. I've just been using bash for far too long to switch to something different.
[0] https://eli.thegreenplace.net/2013/06/11/keeping-persistent-...
Re: Shell Tricks That Make Life Easier (and Save Your Sanity)
#38Re: Shell Tricks That Make Life Easier (and Save Your Sanity)
#39I just open, agent in tui, and ask it to do what I want and make a plan, i read the plan edit it and run it. Simple, no need to learn any commandline these days. I used to use arch and all, and managed many big projects. I find little value in learning new tools anymore, just feed it docs and it generated working plan most of the time Now I've moved to coding in Haskell, which i find suits me better than wasting my t…
I will never understand people like you.
Re: Shell Tricks That Make Life Easier (and Save Your Sanity)
#40I 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 ```
mycmd1 #| mycmd2