Learn by reading through in order

Terminal Basics — pwd, ls, cd

Take your first steps in the Linux terminal — pwd for where you are, ls to list, cd to move — running a real Linux environment live in a browser terminal.

About the Linux in this course

This course covers the universal command-line operations shared across major distributions like Ubuntu, Debian, and CentOS.

Basics like cd / ls / cp / mv / grep and pipes work the same way on any Linux server.

The browser terminal uses Buildroot Linux (busybox) because of technical constraints.

Whenever a detail differs between distributions (a few options, or how help is read), we'll show the other environments side by side, like here's how you write it on Ubuntu.

What are Linux and the terminal?

Linux is an OS that runs on servers, cloud platforms, and embedded devices all over the world.

With the terminal (the command line), you can handle file operations, run programs, and manage servers using only the keyboard.

It's an essential skill for engineers.

How a command gets executed
YouTerminalLinuxruns the commandResult shown on screen① Type② Pass on③ Result
Linux runs the command you typed and returns the result to the terminal screen.

Using the terminal

This terminal runs a real Linux environment (Buildroot Linux).

It takes a moment to boot.

Once the # prompt (the symbol that means it's ready for input) appears, you can type commands.

Drag to select text inside the terminal and it's copied automatically.

Wait a moment for the terminal to boot. Once a prompt like # appears, it's ready for input. Try typing a few characters and pressing Enter to confirm the terminal responds.

Linux console
Loading Linux Terminal...

Check where you are — pwd

pwd (Print Working Directory) shows the absolute path of the directory you're currently in.

Whenever you lose track of where you are in the file system, run pwd first to check your location.

Where pwd points
/top level/rootyou are here (pwd result)/etc/tmp
pwd shows your current location as an absolute path (here, /root).
pwd
# e.g. /root

Right after boot, where are you in the file system? Use the command that prints the path of your current directory to check your location. (Run it correctly and an explanation will appear.)

Linux console
0 / 1 completed
Loading Linux Terminal...

List files — ls

ls lists the contents of a directory.

Add -l for a detailed view showing permissions, size, and modification time, and add -a to also show hidden files whose names start with ..

The combined ls -la is the one you'll use most.

ls vs ls -l vs ls -la
lsls -lls -lanames onlypermissions, size, date+ hidden filesadd -ladd -a
-l gives a detailed view; -a also shows hidden files starting with ..
ls          # list
ls -l       # detailed view (permissions, size, date)
ls -la      # detailed view including hidden files
ls /etc     # list a specific directory

ls has several common options that change what it shows.

CommandWhat it shows
lsLists names only
ls -lDetailed view with permissions, size, and modification time
ls -aAlso shows hidden files starting with .
ls -laDetailed view combined with hidden files
ls -RLists subdirectories recursively
ls -1Lists one entry per line

① First, list the files in the current directory normally.

② Next, show them in a detailed format with permissions, size, and modification time, including hidden files that start with ..

Linux console
0 / 2 completed
Loading Linux Terminal...

Move between directories — cd

cd (Change Directory) moves you between directories.

Use .. to go up one level, ~ for the home directory, and / for the root.

After moving, make a habit of checking where you are with pwd.

The home directory is a dedicated directory provided for each user.

It's the starting point for your work files and personal settings; in this terminal, the root user's /root is the home directory.

~ (tilde) is shorthand for that path, so cd ~ returns you home from anywhere.

Moving around with cd
/ root/roothome (after boot)/tmptemp area/rootback homecd /tmpcd ~
cd moves your location. ~ = home, .. = up one, / = root.
cd /tmp     # move to /tmp
pwd         # check current location
cd ..       # go up one level
cd ~        # back home
cd /        # to the root

① Move to the /tmp directory, commonly used as a scratch space for temporary files, and show your location with pwd to confirm the move.

② Then return to the home directory and run pwd again to confirm you're back.

Linux console
0 / 3 completed
Loading Linux Terminal...
QUIZ

Knowledge Check

Answer each question one by one.

Q1Which command shows the path of the directory you're currently in?

Q2What does the ls -la command show?

Q3Where does cd ~ take you?