Introduction To the Linux Terminal (CLI)

The terminal is a text-based interface that’s used to interact with a Linux computer. The terminal is mostly what scares off users new to Linux, and it looks like this:

Do not be intimidated by the Linux terminal.

The terminal is also referred to as the Command Line Interface (CLI) or shell because it is where commands are fed into the system, interpreted and executed. There are several shells but the common ones are Bourne-Again shell (bash) and Z shell (zsh).

Getting Access To the Terminal on Windows

If you are not already running Linux on your computer (or not using a Mac) then you are most likely running windows. This lesson and the others that follow it require that you have access to a Linux terminal. If you are running windows you can install git for Windows or refer to this link to determine how best you can get access to a terminal and follow along. There are a bunch of online terminals you can try to see which works best for you here. Please note that some may require that you create an account.

Breakdown Of the Command Line Interface

Whenever you open the terminal or log into a linux server you will be placed at the command prompt and it will be ready to accept commands. Here is a breakdown of the Linux command prompt:

A breakdown of the Linux command prompt

The command prompt is made up of 4 major parts:

The logged in user’s username

The name of the server or computer. This could also be an IP address.

The current location or directory. The ~ or tilde represents the logged in user’s home directory which is a path. Typing pwd in the terminal shows the path of the current directory, in this case it prints /Users/buls (more on this when we talk about navigation in a subsequent lesson).

The % indicates the end of the command prompt. All commands supplied by you come after this symbol.

How Linux Commands Work

Commands let you do things in Linux. Commands are typed and executed on the command prompt. Each command represents the name of a program meant to accomplish a specific thing and using Linux is mostly about knowing what command to use, how to use it, and when.

The Linux is case sensitive so commands that are meant to be given in lowercase will fail when given in uppercase. This is true for file names and directory names as well.

Whenever you type a command in the command prompt and press enter, Linux executes the command in a process. Linux is known for being very efficient with computer resources so commands execute and complete quite quickly. This speed and efficiency is part of what makes Linux the popular choice for cloud servers.

Anatomy Of Linux Commands

Here is a list of some common Linux commands

  • ls – list the contents of a directory
  • cd – change directory
  • mkdir – create a new directory
  • cp – copy files or directories
  • pwd – display the absolute path of the present directory

Commands can be executed with/without arguments or options. Options are also referred to as flags or switches. Let’s take the ls command for example and see the different ways it can be executed.

Executing Commands Without Arguments Or Options

Type ls in the command prompt and press enter. This will list contents of the current directory. In this example the ls command is executed without arguments or options.

The ls command executed without arguments or options lists the contents of the directory.

Executing Commands With Arguments And Without Options

Type ls followed by the name of a directory (generally the names without extensions) and press enter. This will list the contents of the directory without having to move into the directory. In this example the ls command is executed with an argument and the argument is a directory name (ignore the \ for now, they simply make sure the spaces in the directory name do no cause any issues while executing the ls command).

The ls command executed with one argument which is a name of a directory to view its contents.

Executing Commands With Options And Without Arguments

Commands can be executed with options. Options are like additional instructions that can change the way a command behaves. Options are specified with a – or –.

Type ls -l and press enter. This displays the contents of the current directory in a long list form instead of columns (as shown above). It also provides other useful metadata about the contents. The -l option is an instruction to display the contents as a long listing.

ls command executed with an option and no arguments

Combining Options

Options can be combined. This means you can specify more than one option at a time. Type ls -lh and press enter. The contents of the current directory are also displayed in a long list form but you’ll also notice that the file sizes are labeled in a way that is easier to understand. The h option is an instruction to display files sizes in a human readable manner.

ls command with a combination of options.

Executing Commands With Arguments And Options

Linux allows you specify arguments and options when executing a command. Type ls -lh <directory-name> and press enter (replace <directory-name> with an actual directory name on your computer). Without moving into the directory, the command will list the contents of the specified directory in long listing form and display file sizes in a human readable manner.

ls command executed with combined options and an argument.


The Linux terminal is what scares off people that are new to the operating system. At the same time almost everything you’ll do with Linux requires knowledge of the terminal. Once you’ve gotten your hands dirty you’ll find out that it isn’t so scary after all and you may find it fun and powerful just like the vast majority of Linux users.

The next lesson in this course is Basic Linux Navigation.

Back to: Basic Linux for Cloud Computing > Linux Fundamentals