Command Line Basics

First steps on the command line

Rusben Guzman
2 min readApr 26, 2021
Photo by Arget on Unsplash

What is the command line?

We are used to navigating on the computer using the mouse and clicking different icons, buttons or media to do some task on it basically. The command line is just a text interface for your computer. It’s a program that receives a word or a phrase called “command” to execute a specific task.

Why use the command line?

Even if the GUI seems easier, the command line offers many advantages over it like better control over OS functions, automate tasks via script, help with troubleshooting and that is only the basics. Every developer should learn about how to use the command because at some point it is very likely that they will need it for their work, some examples are:

  • Using git for version control
  • Installing packages of libraries with NPM or Composer.
  • Local backend development
  • Cloud computing

Opening the terminal:

If you are using Windows as OS you won’t be able to execute some commands from the default cmd. Some alternatives that you can download are Cmder or Git Bash (Git Bash is included when you install Git on your computer). Just install some of these terminals and open it.

To open the command line on Linux or Mac just go to applications and open “Terminal”:

Basic commands for navigating:

  • ls: list all files and directories in the working directory:
ls

Tip: you can use “ls -a” to show all content in the directory including hidden files and directories.

  • cd: takes a directory name as an argument and switch into that directory
cd <directory name>

Note: if the directory name has spaces you have to use a weird syntax with backslashes instead use the spaces. To avoid that you can type the name between quotes.

Tip: You can also type part of the name of the directory where you want to switch and press “tab” to autocomplete.

  • clear: is used to clear the terminal screen.
clear

Now you know the necessary commands to navigate through the terminal. If you want to learn more commands visit the link below.

https://www.codecademy.com/articles/command-line-commands

--

--

Rusben Guzman
Rusben Guzman

Written by Rusben Guzman

A Software Engineer passionate about game dev and interactive products with Unity. I consider video games to be the artistic expression of programming.

No responses yet