As I use the command line more and more, I realise there are more efficient ways of going about things that may not be obvious when you first start. Here’s a list of the most useful commands, concepts, and shortcuts I’ve come across when using the command line.
I will update this list as I come across more concepts that I find helpful.
Shortcuts to generally save time
tabto auto-complete names (files, folders, or programs) in your current directoryctrl+cto cancel what you’ve written and start fresh, or terminates a process that’s currently runningcd+-to change to the last directory that you were in (especially useful if you’re switching back and forth between two directories)ctrl+rto search through your command line history
Shortcuts for text editing
ctrl+amoves the cursor to the beginning of the linectrl+emoves the cursor to the end of the linealt+f(oralt+→on a Mac) moves the cursor to the next wordalt+b(oralt+←on a Mac) moves the cursor back to the previous wordctrl+kdeletes the text from the cursor to the end of the linectrl+udeletes the text from the cursor to the beginning of the line
Resources
- The Linux Command Line by William Shotts (freely available here) provides a friendly introduction to what you need to know about the command line.
- Efficient Linux at the Command Line: Boost Your Command-Line Skills by Daniel J. Barrett (book details here) provides intermediate users tips on how to better use the command line.