10 Terminal Commandments for Coding Newbies

Taylor Overturf - Dec 5 '21 - - Dev Community

The terminal can be an intimidating place for anyone, like me, who has spent most of their life living in a ✨Graphical User Interface✨ paradise.

In the GUI, it seems like nothing can really go that wrong. However, on the command line, it feels like a single cat-on-keyboard moment can bring everything crashing down. 🐱🔥

It is my belief that the terminal itself is not what frightens us, but the unfamiliarity of it all. Once you build up your confidence, the terminal can, and will, be your new best friend. 👯 I promise!

The first time I entered the terminal, I had no idea where I was. You don't believe me? Look at the first 15 commands I ever ran:
Image description Unfortunately, hello and where am i, yielded no results. You know what did? Making a ton of mistakes, which I like to call, "practice." (I really got my ls practice in here, see lines 6 to 9).

So, here are my Top 10 Terminal Commandments. These helped me become more comfortable working on the command line, and I hope they help you, too! 💛

1. history

If you're anything like me, you routinely forget the command you ran 5 seconds ago. Run history to get a friendly reminder. You will see all the commands you have previously run. And, if you don't mind scrolling for several minutes, try to find your first 15 commands by going all the way up. Perhaps you, too, wondered: where am i? 🌍

2. exit

Image description This is a best practice that I turned into a habit very early on in my coding journey and I'm grateful I did. By using exit at the end of every session, you are setting yourself up for success later on when it will be important to exit out of multiple servers and live ports. Use exit whenever you're done in the terminal, instead of just quitting or x-ing out. Your future coder-self will thank you! 🙏

3. mv old-file-name-you-dont-want new-file-name-you-do-want

I can't tell you how many times I've misspelled something and thought, "Oh well, I guess it will just be called main-directury for the rest of my life." 🤷‍♀️ For some reason, as a coding newbie, I find it scarier to delete and edit than it is to create. However, don't be fearful of the mv command. You can easily rename your files for times when you have a typo or simply realized there's a better name out there for your project or file.

4. touch new-file-name

🏆 This one gets the award for Cutest Command, touch whenever you want to create a new file. Not to be confused with the less cute, mkdir which will just create a folder (directory).

5. pwd

Print Working Directory or pwd is the command I was looking for when I ran where am i. It will tell you exactly where you are within your file structure! This is helpful for when you want to confirm your location before running another command.

6. ls

List all the contents of a folder. This is extremely helpful as there is no graphical interface showing you all your files, you either need to remember (not going to happen!) or see what your options are. 🧐

7. cd

Move into a folder. ⬇️ Think of it as moving level down within your file structure.

8. ..

Move out of a folder. ⬆️ Think of it as moving one level up within your file structure.

9. CMD + t

Did you know, just like your browser, you can also open a new tab in your terminal? Maybe you cd-ed into the depths of one folder and now you want to move back out .. without losing your spot. The CMD + t action will open a new tab where you currently are (which is different than opening up the terminal application on your computer). Use it when you want to be in two places at the same time! 🪄

10. CTRL + c

Did you just start running something that you instantly regret? 😱 Try the action CTRL + c to clear. This will become handy later with Git and installations and servers and other levels of chaos, but it is helpful to hardwire into your brain now so that you always have an escape plan!

Yes, the terminal can be a scary place for us beginners. But, every time you run ls a coding fairy gets its wings. So ls all day long, my friends! I guarantee you will start to feel more comfortable as you practice these 10 Terminal Commandments. Finally, love thy coding newbie as thyself–comment, re-post, print, bookmark, subscribe or share this post!

. . . .
Terabox Video Player