Activity 2 - Determine User Location

Workshop Resources

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.

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

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

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


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

• /: This is the symbol for the root directory of this filesystem.
• /home: This is the path of the home directory, which is located within the root directory.
• /home/nuvi: This is the path for the nuvi directory, which is located within the home directory. The output stops here, meaning /home/nuvi is the current working directory where we are located.
• This process of going into the filesystem through each folder can go on for many more steps in some cases.
• The path shown and described above is called the absolute path, because it is the path given from the current directory all the way up to the root directory.

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].

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 ..


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 ...

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