cft

Getting friendly with the terminal: a super-friendly beginner’s guide

This is the first article in the 'Getting friendly‘ series, which intends to provide easy to follow guides for different tech topics. This article talks about the terminal and how it can be your best friend and not your foe.


user

Sammy-Jo Wymer

2 years ago | 5 min read

Original post can be found here and is credited to REWRITE TECH by diconium.

This article is intended for anyone who is intimated by the terminal.

I’m not sure about you, but as a ‘newbie’ in the tech world I was very intimidated by the terminal to begin with.This article will show you that this terminal fear is not, well… terminal.

I started my coding journey around 7 months agoand I avoided the terminal like the plague. It felt soadvancedand beyond my comfort zone. I was terrified that I was going to delete everything on my laptop and possibly the whole universe.

Four months after my coding journey started, I was lucky enough to land my first tech job as a Junior Software Engineer at diconium. Whatever I had learned in the 4 months prior, I’ve learned tenfold in my first 2 months here. This includes learning to love the terminal and realising that it’s your friend, not your foe.

…learn to love the terminal and realise that it’s your friend, not your foe.

This blossoming friendship started around 5 weeks ago, when I started on my first project at diconium. This project is heavily focused on configuration and git — two things I was not at all confident about. With regards to git, I had previously only worked with GitHub and GitHub Desktop, which requires no use of the terminal at all.

However, I found out that my work project is onGitLaband the process for making and submitting code changes is much different to what I was used to. This meant that I had to get good at git, which meant getting comfortable with the terminal — and I had to do this pretty quickly.

Naturally, I watched some online tutorials and read about the most common git commands on Atlassian. This was great, and provided me with knowledge of the necessary commands and what they do; but I quickly found the sheer amount of information overwhelming and there was far too much to process for it to stick.

.. I quickly found the sheer amount of information on git commands to be overwhelming…

I’m definitely a learning-through-doing type of person, and I think git can only really be learned this way.I, therefore, found this online resource to be wonderful. It’s pretty addictive too, in a good way.

It’s an interactive website which explains the different git command and when to use them. The best part is that you have to use what you have learned to complete the challenges (which get increasingly more difficult). I also made some handy ‘go-to’ notes for when I use git in the ‘real world’. These notes have been like gold dust during my first weeks on the project and highly recommend that you do the same.

The notes I made while learning git commands have been like gold dust during my first weeks on the project and highly recommend that you make notes too.

So, it was through learning git that my bond with the terminal began.

* I’ll pause right now and tell you, by no means did I suddenly become a terminal or git expert in the last month, quite the contrary; but I do now enjoy and rather prefer using the terminal, and I look forward to learning even more terminal commands to make my coding life easier.

The key terminal commands I have found useful are actually pretty simple.

Go ahead and open your terminal and you can practice these commands yourself.

When you open your terminal, you should see the following:

Unsplash.com and diconium

Git for beginners

I am a MacBook user and so if you’re on Windows or Linux this may look different, but that isn’t too important. What is important is that you can see which folder you are currently in. From the example above, you can see that I am currently in /Users/wymersam. This is the equivalent of having this folder open with Finder.

You can try this out yourself if you like. Just open Finder and navigate to the path/folder that is shown in the terminal. To make sure you’re in the correct folder, in the terminal, type:ls(ls stands for ‘list’).

This command will show you the contents of the folder you are in.

See? The contents are exactly the same as in the Finder window.

You can navigate to a folder by typing:cd <folderName>(cd stands for ‘change directory’).

So for example, I would type:cd my-folder

And this would take me to the my-folder folder. You can typelsafter running this command to check that you are in the correct folder.

TIP: You can type the first letters of a folder and if these are unique (e.g., no other folder starts with these letters), you can press ‘tab’ and this will autocomplete the rest of the folder name for you.

To get back out of a folder, simple type:cd ..

Thecdcommand is only useful for opening folders. If you want to open a file, navigate to the relevant folder and type:open <fileName>

For example, I could type:open FC_Liverpool.pngand this would open a truly beautiful image.

Photo by Finn on Unsplash

To create a new file, type:touch <fileName>and the extension

For example:touch index.html(here.htmlis the extension)

You can then typeopen index.html’ and this will open the file. You could try this with different file types, such as .js .docx, etc.)

When I was first learning these commands, I thought I’d never use them. I thought navigating to the files / folders and creating them the ‘old-fashioned’ way was the best way but I’ve since changed my mind. Obviously, or I wouldn’t be writing this article.

Using the terminal really speeds things up and you can do everything from one place.

To create a folder, type:mkdir <folderName>(mkdir stands for ‘make directory’).

For example:mkdir test-folder

You can then navigate to this folder with:cd test-folder

To delete a folder, navigate to the parent folder. In this case,test-folderwas created in Documents. Since I was in test-folder I typedcd ..to get out of this folder and back into the Documents folder.

From here, type:rm -r <folderName>(rm stands for ‘remove’ and the -r will recursively delete everything inside that directory).

For example:rm -r test-folder

Again, you can typelsto check if this worked.

Photo by Gabriel Heinzer onUnsplash

So there you go. Those are some of the simple terminal commands you can use to get acquainted with your soon-to-be terminal buddy.

NOTE: You can use any terminal on your computer for this. I always use the terminal in my IDE (VS code) when working with git.

One final, final thing I want to show you before I leave you is how to easily configure your terminal to make it pretty.

Source: Stack Overflow

Below you will see the configuration I have. It’s pretty basic, but if you want to configure more then this may help. The“workbench.colorTheme”: “Dracula” is the colour theme for my IDE. You may need to download this theme on VS code, but it’s free :).

Configuration for VS code terminal

I hope this pretty basic article helped you to feel more comfortable using the terminal. I still have a lot to learn but, believe me, if I can do it anyone can.

Keep challenging yourself and remember, being uncomfortable means you are growing.

Upcoming post in the “Getting friendly with…” series:Getting friendly with git: a super-friendly beginner’s guide.

Upvote


user
Created by

Sammy-Jo Wymer


people
Post

Upvote

Downvote

Comment

Bookmark

Share


Related Articles