Tip: Set MANPAGER='less -j2' to make the search in man pages much more convenient, since the line before the search term will be viewable. Use bigger numbers if you like or add it to LESS instead. Details: https://www.schoenitzer.de/blog/2022/Shorter%20Hacks%207%20better%20search%20in%20man%20pages.html #shorterhacks
Normal pipes in bash/zsh only redirect stdout to the target process. If you, for example want to grep the output of strace you need to also redirect stderr to the target. You can do this by strace ls |& grep open. On older versions of bash you need the less handy strace ls 2>&1 | grep open. #ShorterHacks
If a diff is hard to read because the changes are small, try `git diff --word-diff`. While the default diffing algorithm works line wise, this will show you changes within a line. #shorterhacks #git
To get the hosts ip address, I used to use 'ip addr' – but the output is noisy and the address hard to spot. Use 'hostname -i' instead, to get exactly what you need. #ShorterHacks
You probably know cd - to move back into the previous directory. Git offers the same handy shortcut to refer to the last checked-out branch. So, you can conveniently switch between two branches by git checkout -, or merge the previous branch by git merge -, etc. #ShorterHacks https://www.schoenitzer.de/blog/2021/Shorter%20Hacks%201%20Git%20dash.html