Skip to main content

tyler@zealousOS: ~/courses/linux/navigation-basics/002-where-am-i$

Where Am I

Knowing Where You Are

In the previous lesson, we focused on getting comfortable inside a terminal emulator and running our first command.

In this lesson, we are going to learn how to answer a very important question:

Where am I on the filesystem right now?

To do that, we will need to review some terminology and then have some fun learning a new command, which is pwd.

Graphical User Interfaces

If you are new to Linux and terminal emulators, you may not be aware of the acronymn, GUI. Let’s break it down.

GUI stands for Graphical User Interface.

This is different than a CLI, which stands for Command Line Interface.

Here is a table to break these terms down further.

TermDescription
GraphicalDisplayed visually on the screen.
User InterfaceA part of the system a user interacts with.

As you can see, GUIs are not that complicated. They are just visually displayed applications that we, as the user, can interact with on our computer system.

A Familiar GUI Concept

To bring things closer to home, you are likely used to navigating around the filesystem on your computer using a GUI program, such as:

Linux GUI Example

Here is a screenshot of COSMIC Files, a GUI from a Linux computer.

A Screenshot of the COSMIC Files GUI

As you can see in the above image, the GUI is telling us that we are in a folder called Home.

It also tells us what the contents of this folder are.

We can see that the contents of the Home folder are other folders nested within the Home folder.

For example, Documents, Downloads, and Pictures are all folders within the Home folder.

A Familiar CLI Concept

In Lesson 1: Getting Started, you used JSLinux as a Command Line Interface when you typed out and executed the clear command.

You are already on your way to become a Linux pro!

You are a CLI user!


Time for Some Fun

Now that we have gotten some terminology out of the way, it is time to have some fun!

We are going to use a new command to find out what directory we are currently working in.

Type pwd into your terminal emulator and press Enter/Return to execute the command.

Taking a Look at the Result

If all went well, you should see something similar to the following output:

PWD Result in JSLinux

Let’s take a closer look at the output one line at a time.

Line 1
1
2
3
localhost:~# pwd # <-- This is Line 1
/root
localhost:~#

As you learned in the previous lesson, localhost:~# is the prompt, which we don’t need to worry about right now.

This line simply shows the prompt and the pwd command we typed before pressing Enter/Return.

Line 2
1
2
3
localhost:~# pwd
/root # <-- This is Line 2
localhost:~#

The second line contains the text /root.

This is the output produced by the pwd command that we entered into the terminal.

/root tells us two important things:

To summarize:

We are in a directory named root, and that directory is located at the top level of the filesystem, represented by a single forward slash (/).

We will explore this mysterious “top level” more in future lessons.

Line 3
1
2
3
localhost:~# pwd
/root
localhost:~# # <-- This is Line 3

The final line is simply the prompt again, waiting for us to type another command.

Think of this as a fresh starting point.

We ran a command on Line 1, read its output on Line 2, and are now ready to enter another command on Line 3.

Learning about Our New Command: pwd

The pwd command stands for print working directory.

The working directory is simply the directory where we are currently working.

Typing commands may feel unfamiliar at first, but it will become more natural as the lessons progress. Keep going.

Wrapping Up

Woah—you are already learning a lot.

In this lesson, you learned:

In the next lesson, we’ll take a break from filesystem theory and focus on something hands-on: learning how to list the contents of the current working directory.