x

We use the latest technologies to provide the best experience!

Please download a newer version of your browser. Click to close

Looking to get better at JavaScript?
Join us in the Academy and boost your learning curve!
Command Line Interface, the coding terminal

What is a Coding Terminal?

Everything you need to about the what's and the how's of a coding terminal
Karla E. Costa Silva
JavaScript Teacher
17 August 2020
If you’re familiar with sci-fi movies like The Matrix or hacker series like Mr Robot or basically any movie/show related to IT/hacking, you've already found yourself staring at a black screen with a lot of data on it, probably very similar to the one displayed above. When you look at it, it's likely that you don't really understand what is going on and just associate it to hackers or high-level tech. What you'd be surprised to learn - unless you already know a bit of programming - is that the terminal, which is what the black screen with lots of code is called is part of the daily life of most programmers and that it's quite easy and handy to use. So today we will learn a bit about the terminal and by the end of this article, you'll even be able to run a few commands of your own.
What is a terminal and why do we use it?
Before we jump into trying new things, it's important to know what a terminal is and why we use it. In short, the terminal allows us to accomplish and automate tasks on a computer without the use of a graphical user interface (GUI), but instead using a command-line interface (CLI). This means that if you want to access a folder or create a new file, for example, you don't have to go clicking around. You can just use a few command lines instead, which is very helpful when you are programming and need to navigate through your file system. Of course, there are more complicated tasks like installing software, programming languages, executing code we write etc, but we won't dive that deep in this article.
picture illustrating a graphical user interface vs the command line interfaceHow to use a Terminal
Now that you know a bit about the terminal, we’re ready to start using it. If you want to follow along, we have to make sure you are all set up, depending on your OS:
  •     - MacOS: you can download iTerm2 here
  •     - Linux: default terminal, just click on Activities and search for Terminal 
  •     - Windows: you can download Windows Terminal here

Run Terminal commandsGreat! Now open your terminal and let’s run a few commands to get used to the command line and learn how to navigate your file system.Quick note: in the following examples, you'll notice that my terminal is more colorful and a bit more user friendly. That's because I use the Oh My Zsh framework, which you can use too - here’s the installationprocess.
The first command we are going to run is ~echo and it's used to display a string/text that is passed as argument. Just to stick to tradition, let's first display the string Hello World.
Terminal command to type Hello WorldWhenever you want to know which folder you’re in, run the command ~pwd It means print working directory and it will tell you if you’re in the right folder. terminal command using pwdIn the next example, we will be using a few more commands: ~mkdir (to create a new directory/folder), ~cd (to change the directory), ~touch (to create a new file) and ~ls (to show a list of files and folders in that directory). You can also use the ~cd command to exit a directory: if you run ~cd alone, you’ll go to your root directory, while ~cd .. ill take you up one directory.
terminal commands using various onesOther useful commands are ~open and ~exit ; you can use the first one to open any file directly from the terminal (the correct syntax is ~open + <filename>) and typing ~exit will close the terminal. The last command I’ll talk about here is the ~man (manual) command. Anytime you are not sure how to use a command or if you just want to get more information, you can type ~man + <command> . To exit that page, you need to press qterminal command man exit
Want to learn more?
We just went through some very simple and basic commands, so if you want to keep using the CLI and learn more about it, I recommend checking out this full list of commands for Mac users. Most of them can also be used on Linux/Windows, but some might differ, so you can also check this list for Linux and Windows
And if you’re thinking about joining Codaisseur, you should know that here, we use the terminal from day one, so by the end of the course, you’ll be very comfortable with this technology!

Interested in more?

Read more of our articles.