Shell Tricks That Actually Make Life Easier (And Save Your Sanity)

66 points by wezm


fanf

History expansion like !! caused me enough footgun incidents that I disabled it over 25 years ago. It takes effect at a separate layer before normal shell language parsing happens, so it interacts badly with things like quoting and escaping. And it interacts weirdly with history: the command is recorded after expansion, which annoyed me because I want shell history to record what I wrote. I prefer using readline editing commands like M-. (last arg of previous command) because they give me interactive confirmation of what I’m about to do, unlike ! runes which require a tedious amount of error-prone counting and a leap of faith when pressing enter.