Developers usually learn the terminal in segments. Early on, the typical knowledge required to survive is learned. What a majority don’t learn are tools that boost efficiency. These commands cannot be overlooked and become prominantly useful with time. There are four of these very useful commands.
grep
Searching files for a snippet of text is something grep excels at. After learning this command a question that takes five minutes to answer manually is answered instantly by a single command. Combining grep with -r yields the same results to searching through an entire project folder.
cd –
A more useful but deeply underrated command is cd -. It takes you to the last directory used, that was one used before last. It sounds miniscule until you see that repeatedly switching between two directories requires you to enter the whole path, which is a very time consuming typing error prone task.
Tab completion
Like cd -, Tab completion is something that is frequently used but doesn’t need to be treated as such. This is half the reason why it things feel awkward for a day. Tab completion autofills a directory name and is vital for speeding up the terminal.
These four commands save time and become instantly useful.
history | grep fixes that issue you always have of trying to remember that complicated command you ran a few days ago. Instead of forcing yourself to remember and reconstruct the command, it searches your command history and brings adjacent commands to the shell.
ctrl+r does a search in the reverse direction of your command history, and for each keystroke, shows you commands that match. In conjunction with history | grep, you almost never have to type long, often used but commonly forgotten commands.
None of these commands are that complicated to remember, and that’s the idea. These small, often forgotten commands speed up your workflow if you use them automatically.