Activity 2 - Determine User Location

Workshop Resources

Uma foto de Nuvi
Before we can stop the hackers, we need to learn to navigate the Linux filesystem.

What is a filesystem?

A filesystem is a structured collection of files and data on a computer disk or drive. The highest level of a filesystem is referred to as the “root”. You can think of it as the beginning of the filesystem.

Fun fact: filesystems are often described as a “tree”. This is because the filesystem looks like an upside down tree with each folder as a branch or leaf. For example, your filesystem may look like the below.

Picture of a filesystem tree

On a Windows computer, you can browse the computer’s “C:" drive filesystem using “File Explorer” like below:

Picture of a Windows file explorer

On a Mac, you can browse the computer’s home filesystem in “Finder” like below:

Picture of the Mac file finder

Where in the filesystem are you?

We want to find out what our “current working directory” is. This is the location in the filesystem that you are currently at.

The Linux command pwd will display your current location. This stands for “Print Working Directory”. Try it!

pwd command

The output above is /home/nuvi and its meaning is explained below:

How do I move around the filesystem?

To move to a different directory, use the command cd. This stands for “Change Directory”. The format of this command is cd [directory name].

cd command

In the output above, you can see that when we type pwd again, the working directory we are in is now Desktop. Try cd ...

Try one more example of cd below:

cd ..
cd command

The .. after the cd command takes you one level up the filesystem tree. The output of pwd now shows we are back where we started. We began in the nuvi directory, moved down the tree into Desktop with cd Desktop, and then moved up the tree with cd ...

Uma foto de Nuvi
Great job, next we'll look at how to explore the directories themselves.