Skip to main content
Logo image

Section 14.4 Linux File System

Subsection 14.4.1 Navigation Commands

To begin exploring how to find your files using typed commands in Linux, we must learn how to navigate between folders using only typed commands.
The first command we will study is ls. This command lists the content of a directory. You of course are familiar with how to accomplish the equivalent in a file browser: you simply click on the folder icon and automatically are shown the files inside the folder.

Activity 14.1.

Try it out by typing ls in your terminal window. What happens?
Switches can be added to a command to modify its behavior. For ls, switches include:
  • -l: long listing (type ls -l into the terminal window to try it out)
  • -t: sorts by date (type ls -t)
  • -a: show all files, even those that are hidden by the operating system (type ls -a)
You can also combine several switches in arbitrary order:
  • -lta: shows a long listing, sorted by date, of all files (type ls -lta)
  • See List of Linux Commands for more switches and description of ls

Activity 14.2.

Now, try typing ls engs20 into the terminal window. What do you see? How would you accomplish this in the file browser?
The next command we will discuss is cd. This command is used to change the directory in which you find yourself.

Activity 14.3.

Try it out by typing cd engs20, then type ls. Now, your file browser and terminal are both pointing to the same directory.
How do we return to the parent directory, which is the directory in which engs20 is located?

Activity 14.4.

Type cd .., then type ls to verify that we are back to where we started. How would you do this in the file browser?
What are all these other directories and where in the file system are we to begin with?

Subsection 14.4.2 Hierarchical File System

The Linux file system is hierarchical and is pretty much organized like a tree. The start of the file system is called its root directory: /. Type cd /, then type ls. You should see something like the following:
Where did engs20 go? Don’t worry, we’ll find it!

Subsection 14.4.3 Expanded Hierarchical File System

Can you find your engs20 folder now?

Activity 14.5.

Now that you know where it is located, what Linux commands do you type in the terminal window to get you back into the engs20 folder?