Command Line Basics: A Short & Sweet Introduction

An aesthetic computer gif
Ready to start your command line journey? Let’s get to it.

*Note: The tutorial assumes you are on a Mac or Unix operating system. The purpose of the command line is the same across all operating systems – navigating and manipulating files and folders that live on your computer. The only difference is the syntax for the commands will differ on Windows.

There is a workaround though 😉. If you are on Windows and want to follow this exact tutorial (which uses commands heavily similar to Linux), I recommend enabling Windows Subsystem for Linux.

My aim with this post is to (hopefully) help anyone overcome a fear of the command line by proving a short, practical introduction to navigating the command line by creating folders and files.

This is not an in-depth, comprehensive guide to all things command line. This does not contain an exhaustive list of every command ever created nor do I intend to. Even the most experienced professionals in tech do not seek to memorize everything, that’s what Google is for😛 . Will you unlock the power level of a Command Line legend? No, not quite. However, this tutorial will get you up and running so you can start navigating the command line with ease.

I also made a cheatsheet summarizing the basic commands and a visual of how the tree-like file structure so you can download it here! Bookmark and refer to it as you continue your journey in tech <3


  • Understand what the terms GUI and Command Line mean
  • How to navigate the filesystem
  • Create a Project folder, file, write in the file and view it…all in the command line!

What is the Command Line (CLI)?

The command prompt is an interface that enables you to interact with your operating system and gives you the power to navigate and manipulate the files and folders (aka directories) that live on your computer. You’re probably familiar with your Finder (on Mac) or where you are provided with a GUI (graphical user interface), which is a visual representation of all of the folders and files on your operating system. Check out the visual guide below to see how the filesystem looks in a GUI vs the terminal. They’re all the same.

In the example I am listing all of the content (directories and files) that are located in the parent directory Desktop. The terminal to the right is listing the exact directories and files you see, it’s just all displayed in text format.

A side by side screenshot of the terminal and the graphical user interface (also known as GUI). They are each displaying all of the files and folders that are located on the Desktop.
A visual representation of the GUI and terminal on Mac. They are each displaying the folders and files that live in the Desktop folder

The command line is a text interface for the computer’s OS. You can use it to traverse and edit your computer’s filesystem. Throught the command line you can create new files, edit the contents of those files, delete and more. You will learn how to navigate through a computer’s filesystem solely through command line (view contents of your filesystem, move dir, make files and dir);

A filesystem organizes a computer’s files and directories into a tree structure; it starts with the root directory; each parent directory can contain more child directories and files

How to Access The Command Line

A pixelated image of three computers with pastel colors.
The journey to the command line may be different, but the destination is the same.


  1. Click the 🔍 finder icon in the top right corner
  2. Type terminal and hit enter


CTRL + T on many distros will launch the terminal (Shoutout to @rolandixor for the tip!)

Let’s Start Practicing!

Here is a visual of the exercise!

The Objectives of Our Terminal Exercise:

  • Create a directory (folder) inside of the Desktop directory
  • Create a file and write text
  • Read the contents of our file

There are 2 essential things you must do to get comfortable with anything you are learning – practice and be consistent.

  1. Open your terminal
  2. cd ~ Navigate to the root directory
  3. pwd Print the working directory, aka where you are currently located in the filesystem in the terminal. On Mac It should say something like /Users/Username, in my case, username is Taelur. On Linux, the root directory is in home/username.
  4. cd Desktop Change directories into Desktop folder.
  5. mkdir hello_world Create a directory in Desktop called, hello_world or whatever you wish to name our project folder!
  6. cd hello_world Change into the hello_world directory. It’s kinda empty right now. Let’s add some friends!
  7. touch goals.txt Create a file called goals.txt. The .txt is a file extension indicating we are creating a text file.
  8. ls List all files in the hello_world directory. You should see the goals.txt file we just created.
  9. echo "Say Anything" > goals.txt Use the echo command to write anything you want to the file within the quotation marks. For example, write a summary of your learning goals for 2021
  10. cat goals.txt Output the text that is written in the goals.txt file and read it in the terminal!
  11. (Optional) Run history to see a list of the commands you just ran.

If you were able to successfully print text to the terminal, congratulations, you just learned all of the commands I (and countless others) use on a daily basis! You are well on your way to unlocking more powers! I’m very proud of you ^_^

More Commands To Learn Right Now

Image result for aesthetic computer pixel art gif

$pwd – outputs the name of the current working directory

$ls – Lists all the contents of a directory (folder); can contain files and folders

$cd – Switches you into a different directory

$mkdir – Create a directory

$touch – Creates a new file

$mv – Moves or renames a file

hit tab – Autocompletes a file or folder name; only if you are in the correct directory that contains that file or folder

$ls -t orders files and directories by the time they were last modified

$ls -a – lists all contents of a directory, including hidden files and directories

$ls -l displays a list vertically with permissions, date modified and file name

clear – Clears the terminal; does not delete any folders or files, don’t worry!

$history – Lists all previous commands you’ve made

$help <command> Provides documentation on the command

$cd .. – Goes up one directory!

If you want to learn more about the command line, check out these free resources below:

freeCodeCamp Command Line Basics Crash Course Video

A Few Words of Advice To Beginners

The key to becoming more comfortable with the command line is practice and repetition. If you end up not feeling the command line and preferring the GUI method of navigating, editing and creating files, that’s fine. The more you start practicing using the terminal, the more confident you’ll become.

The way I’ve been able to use the command line comfortably on a daily basis is because of practice. I learned on my first job. I didn’t even know how to use Git, I ended up learning that. The history command was essential in me remembering.

I was reminded during one of my Twitch streams that everything is hard when you’re first learning it. I have been a programmer for a few years and I still struggle. The key is repetition, practice and googling your way to comfortability with these sorts of things. You’re not alone in the struggle of learning all things tech.

Thank You For Reading!

I hope you enjoyed this introduction to the command line. Feel free to leave a comment below with topics you’d like to see me discuss next and don’t forget to bookmark my cheatsheet! Happy Command-lining ^_^

If you enjoy my content, please consider buying me a coffee on Ko-Fi. For daily updates, check out my Twitter! I stream every Tuesday, Thursday, and Saturday on Twitch where I livestream myself learning programming languages like Python and building projects. You’re more than welcome to join if you’d like to interact and chill with me! Have a great day.

Link to Intro to Command Line Cheatsheet