Top
Best
New

Posted by zdw 1 day ago

Shell Tricks That Make Life Easier (and Save Your Sanity)(blog.hofstede.it)
511 points | 235 commentspage 5
williamcotton 12 hours ago|
Undo:

  Ctrl + _ (Ctrl + underscore)
bandie91 10 hours ago|
it did not work for me in putty, so i added ctrl-x + ctrl-u too:

  bind '"\C-x\C-u": undo'
  bind '"\C-_": undo'
tetris11 16 hours ago||
Never heard of instant truncate, nor `fc`, nor `Esc .`

Quite a few useful ones

rdevilla 6 hours ago||
set -o vi
TheServitor 12 hours ago||
great list but really overboard on the AI generated persona
scuff3d 7 hours ago||
Great write up, had to bookmark so I can go through it more later there so much good stuff in there.

For the CTRL + R tip, you can make it even better if you install fzf. Massively improves searching through history. It's worth the install just for that one feature.

Best thing I ever did as a dev was start spending more time in the terminal. Getting familiar with the tools and how they interact makes life so much easier.

piekvorst 14 hours ago||
Is 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.

xeyownt 13 hours ago||
I knew many of these tricks, but learned many new tricks I didn't know and looks very useful (like you can do Ctrl-Y after an Ctrl-U, the 'reset' or 'disown' thing).

Regarding experience, I'm also struck by how many "experienced" engineers are just clueless with the keyboard.

codeinred 7 hours ago||
I think the keybinding suggestions are really nice. My shell is configured by default such that Alt+Left and Alt+Right move by a word, but having things that work out of the box, basically always, is really useful whenever I need to do things inside a docker container
chinadata 7 hours ago||
only the people do not use pageup and pagedown is who really know how to use shell
aa-jv 16 hours ago|
My favourite shell trick is to comment my code:

  $ some_long_command -with -args -easily -forgotten # thatspecialthing
... Some weeks later ..

  $ CTRL-R<specialthing>
.. finds:

  $ some_long_command -with -args -easily -forgotten # thatspecialthing

Need to see all the special things you've done this week/whenever?

  $ history | grep "\#"
...

Makes for a definite return of sanity ..

scbrg 9 hours ago||
I once saw this pattern referred to as a bashtag, which I think was an excellent name (no matter if you actually run bash as your shell or not).
skydhash 12 hours ago|||
I don’t keep history. Any commands I think will be useful, I save it in a script.
senectus1 16 hours ago||
omg >$ CTRL-R<specialthing>

I could kiss you.. this alone is amazing!

000ooo000 14 hours ago|||
!?specialthing?

If you are feeling brave

fragmede 16 hours ago||||
http://atuin.sh adds a database to store history in and a custom app to use for lookup with added modes to help with searching.
aa-jv 16 hours ago|||
Yes indeed, it is very fun to discover this if you don't know it already, it expands your understanding of your shell life immensely, doesn't it?
More comments...