There's a poster hanging inside the Seattle campus of the Flatiron School. It lists some ubiquitous and helpful keyboard shortcuts -- and I've definitely referenced it several times in the past few weeks.
Need to create a new project? Now I know that "mkdir" is what I'm looking for. Make some new files to populate that directory? "Touch" is the command that does the trick. Who would have thought that navigating through files and folders without a mouse or a single click could be so simple? But if you've got "pwd", "ls", and "cd" under your belt, you can check out what directory you're currently in, list the other files and directories in it, and easily move into a different directory of your choosing. Just gotta know those shortcuts.
But alas. Not everything about the command line interface could be so lovely. If you've spent much time typing your way through the terminal, you, like me, may have experienced the infuriation upon realizing (and then forgetting and remembering, and remembering again), that you cannot simply click anywhere in your line of text to change where your cursor is. Oh no. Your cursor responds to your arrow keys, and likes to make its way back and forth through a line one...slow...space...at...a...time.
Now, I'll be the first to admit it: My typing skills can sometimes be sloppy -- yay for lots of typos. How many times have I entered a long line in the terminal, only to realize that "dc" is not, in fact, the same thing as "cd"? It's perhaps a sign of my millennial impatience that it seems quite irksome to have to hold down the arrow key as my cursor traverses through the entire line of text to get back to the beginning two characters. I learned from one classmate that it's actually possible to increase the speed with which your cursor moves. But still.
And deleting text in bulk? The terminal's refusal to acknowledge my mouse also prevented me from clearing entire words or lines all at once. Again, the joy of holding down the delete key and waiting for the cursor to move left one character at a time. I'm telling you, if time is money, then at those moments it feels like you're hemorrhaging it.
So for those of you are like me: prone to typos (in your EXCITEMENT to get your ideas down!), impatient (ahem, excuse me, EAGER to keep moving along in your project!!), and ready to rejoice at greater efficiency, behold. The all-too-little known terminal commands that will positively change your life.
Need to return to the beginning of the line you're currently typing? "Ctrl + A" = your new best friend.
And to get back to the end of that line -- no sweat. "Ctrl + E"
To delete that whole line in a hurry, just hit "Ctrl + U". And if you'd like to be slightly more selective in your deletions, "Ctrl + W" will delete just the last word typed.
If you'd like to sidestep a search through a lengthy directory (it can be a pain to "ls" all the contents and visually comb through), you can instead begin your terminal command with a bang: "!". If you remember that your file has something to do with giraffes, "cd !giraffe" followed by "Tab" will show you any and all files with "giraffe" in their title.
Careful, though. A double bang "!!" will execute the most recently entered command.
Those commands are a sampling of the ones I'm most grateful to have discovered. Here are a few others... what's your favorite?