02. Introduction to the Shell $PATH, cal, exit

When we talk about the command line we actually are referring to the shell. The shell takes whatever you type in, searches for that command in the directories list in your $PATH variable then runs them through the operating system.

Checking the directories in $PATH

To take a look at the $PATH variable type echo $PATH.

$ echo $PATH

Each directory is separated by a colon (:). We'll look more in-depth about the $PATH variable, and the echo command soon.

Viewing available binaries

For now, let's look at the contents within one of the folders in our path. We can do this with the ls command. Let's look in one of our bin folders, which is short for binaries.

$ ls /usr/bin
... corelist cpan cpan2dist cpanp cpanp-run-perl cpp cpp-4.8 crc32 ...

You should get a long list of commands that are available to you. We'll learn more about folders, the file system and the ls command soon, but just know that the commands you enter in the command line actually come from executable files and not from thin air.

Now try typing some random letters into your terminal.

$ asdf
-bash: asdf: command not found

You should get an error. This is because it's not a command that lives in one of our $PATH directories.

A simple command

Now try the calendar command, cal, which outputs the current month's calendar.

      May 2016        
Su Mo Tu We Th Fr Sa  
 1  2  3  4  5  6  7  
 8  9 10 11 12 13 14  
15 16 17 18 19 20 21  
22 23 24 25 26 27 28  
29 30 31 

There are tons more commands you can use, and even more you can install and write yourself!

In this tutorial series, we'll learn the most commonly used commands, and learn some practical concepts of using the Linux Command Line. Through learning about the commands, we'll slowly begin to transition into learning about the Linux Operating System as a whole.

Exiting like a champ

To exit the terminal from the command line, use:

$ exit

Aching back from coding all day?

Foam Seat Cushion

Aching back from coding all day? Try Back Problems

This foam seat cushion relieves lowerback pain, numbness and pressure sores by promoting healthy weight distribution, posture and spine alignment. Furthermore, it reduces pressure on the tailbone and hip bones while sitting. Perfect for sitting on the computer desk for long periods of time.

$ Check price
99.9599.95Amazon 4.5 logo(9,445+ reviews)

More Back Problems resources

Take your Linux skills to the next level!

Linux for Beginners

Take your Linux skills to the next level! Try Linux & UNIX

Linux for Beginners doesn't make any assumptions about your background or knowledge of Linux. You need no prior knowledge to benefit from this book. You will be guided step by step using a logical and systematic approach. As new concepts, commands, or jargon are encountered they are explained in plain language, making it easy for anyone to understand.

$ Check price
24.9924.99Amazon 4.5 logo(101+ reviews)

More Linux & UNIX resources