January 02, 2018   •   3 min read

Conquering the Command Line

Output on Mac OS terminal after typing: telnet towel.blinkenlights.nl

When I was first introduced to the command line I really had to adjust to navigating my computer in a black box with just text. So I avoided the command line as much as possible. I was accustomed to the visual cues and feedback that a computer usually provides. In many ways it felt like I was re-learning how to use a computer via the command line.

Yet, since first learning how to navigate my computer using UNIX commands I’ve learned that the command line doesn’t have to be a scary thing just because there’s no visual feedback when typing a password in on the command line. As security, nothing shows up as you type in your password to indicate that any characters have been entered.

What is the command line?

The command line is a software that executes commands or instructions for a computer to manipulate or interact with its file system.

What is UNIX?

Why Use the Command Line?

In order to get started on the command line you should navigate to your applications and open the Terminal application.

terminal-1.png Above is the Terminal Icon on Mac.

Create a Basic Website Folder on the Command Line


Folder structure of sample project

A folder with the above structure can be create on the command line by typing the commands inside of an empty directory:


We start inside of an empty directory!

  • Make a directory (also known as a folder) called personal-website
    mkdir personal-website


We’ve created a folder named personal-website

  • Navigate to inside of the directory called personal-website
    cd personal-website
  • create a directory, inside of the personal-website folder called assets
    mkdir assets


We’ve created a folder inside of personal-website to contain all of our assets

  • Navigate inside of the assets folder which is inside of the personal-website folder
    cd assets
  • create a directory, inside of the assets folder named images
    mdkir images
  • create a directory, inside of the assets folder named js
    mkdir js
  • create a directory, inside of the assets folder named css
    mkdir css


We’ve created folders inside of personal-website/assets to store our project’s assets


Woops! We forgot to create an index.html file :(

We are in the assets folder and want an index.html file in our main personal-website folder. Typing cd .. will move us out of the assets folder and into the directory above which is personal-website. Now that we are in the personal-website folder if we type touch index.html a blank index.html file will be created.


Some frequently used terminal commands are:

commands to navigate/manipulate the filesystem

ls - list the contents of a directory

pwd - print working directory for the terminal to display the directory you are currently working on

touch - create or open a file without making any changes
very handy when wanting to create empty files without leaving the command line

sudo - this allows you to run commands as a super user

mv - move a file or directory this can be used to move or rename a file by updating the file path

cd - change the current directory you are working on so that you can access files on a different part of the system
cd moves you to the root directory (top level folder on computer — usually the current User)
cd . current directory
cd .. navigates to directory two levels up

mkdir - make a new directory (or a folder)

Commands to Install Software

You can install some software from the command line using the following commands:

  • in Python pip install <package name>.
    Pip is a software package manager for Python.
  • in JavaScript npm install <package name>
    NPM is a package manager for JavaScript pages.

Commands to Run Software

In order to run a script on the command line you need to provide a command prompt and file name. Some examples are:

  • in Java javac filename.java and then java filename compiles java projects and then runs them.
  • in Python python filename runs python scripts.

If you find you are repeating a lot of commands you can scroll through your recent commands using the up/down arrows and edit them and re-run by navigating to them and then pressing enter.

Additional Resources to Get Started with Command Line Prompts

Decorating the Command Line

You can completely customize the colors and outputs on the command line to better suit your visual and aesthetic needs.

I made my command line appear prettier by installing the theme Tomorrow Night. Check out this site for instructions on installing the theme Tomorrow Night.

A version of this article was originally published by Monica Powell on FreeCodeCamp on December, 5th, 2017

Monica Powell   Twitter

Monica Powell is a web technologist that cares about increasing the visiblity of underestimated individuals in technology. In 2015, she received the #GIRLBOSS award from Sophia Amoruso’s Girl Boss Foundation. She’s currently focusing on making tech more enjoyable & accessible and is always up to chat data visualizations, web development or #BlackGirlMagic.

comments powered by Disqus