$ ls
Documents Downloads Pictures
$ cd Documents
$ _

Command Line Basics: Master the Terminal

Learn the essential commands that power every computer

1

What is the Command Line?

Before fancy graphical interfaces, computers were controlled entirely by typing commands. Today, the command line remains the most powerful way to interact with computers.

/ (root)
├── home/
│ └── username/ ← You are here
│ ├── Documents/
│ ├── Downloads/
│ └── notes.txt
├── var/
└── etc/

Everything is a File

In Linux, everything is organized in a tree structure. Folders (directories) contain files and other folders.

Paths are Addresses

Every file has a unique address called a path, like /home/username/Documents/report.txt

Commands are Verbs

You tell the computer what to do: ls (list), cd (change), mkdir (make).

Fun Fact
The command line is so powerful that most servers in the world have no graphical interface at all - they're controlled entirely through terminal commands!
2

pwd & ls: Where Am I? What's Here?

The first two commands every terminal user needs: find out where you are, and see what's around you.

pwd
"Print Working Directory" - Shows your current location in the filesystem
Example
$ pwd
/home/username
ls
"List" - Shows files and folders in the current directory
Examples
$ ls # List current directory
Documents Downloads Pictures notes.txt
$ ls -l # Long format with details
$ ls -a # Show hidden files (starting with .)

Try It Below!

Use the terminal to explore. Type these commands:

pwd ls ls -l whoami
mytekOS Terminal
Pro Tip
Add -la to ls for the full view: ls -la shows all files (including hidden) in long format!
3

cd: Navigate the Filesystem

Move around the directory tree with the cd (change directory) command. It's like double-clicking folders, but faster!

cd [path]
"Change Directory" - Move to a different location
Special Paths
cd Documents # Go into Documents folder
cd .. # Go UP one level (parent folder)
cd ~ # Go to your home directory
cd / # Go to root (top of filesystem)
cd - # Go to previous location
/ / home / username / Documents
Click segments to understand the path: /home/username/Documents

Relative Paths

Start from where you are: cd Documents goes to Documents inside current folder.

Absolute Paths

Start from root: cd /home/user/Documents works from anywhere.

The .. Shortcut

Two dots means "parent directory". cd ../ goes up one level.

Navigate Around!

Try moving through directories:

cd .. ls pwd
4

mkdir & touch: Create Things

Now let's create! mkdir makes new folders, and touch creates empty files.

mkdir [folder_name]
"Make Directory" - Creates a new folder
Examples
mkdir projects # Create "projects" folder
mkdir -p a/b/c # Create nested folders
touch [filename]
Creates an empty file (or updates timestamp if it exists)
Examples
touch notes.txt # Create empty file
touch file1.txt file2.txt # Create multiple

Build Something!

Create your own folder structure:

mkdir myproject cd myproject touch readme.txt ls
Why "touch"?
The command is called "touch" because it "touches" the file's timestamp. If the file doesn't exist, it creates it. If it does, it updates the modification time!
5

cat: Read File Contents

Want to see what's inside a file? The cat command displays file contents right in your terminal.

cat [filename]
"Concatenate" - Displays file contents (originally for joining files)
Examples
cat notes.txt # Show file contents
cat file1.txt file2.txt # Show multiple files
cat -n notes.txt # Show with line numbers

Quick Preview

Cat is perfect for small files. For large files, use less or head.

Combine Files

Cat can join files: cat a.txt b.txt > combined.txt

Read Some Files!

Try reading files in the terminal:

cat /etc/hostname whoami date
6

Command Quick Reference

Here are all the essential commands you've learned. Click any card to mark it as learned!

pwd
Print Working Directory
ls
List directory contents
cd
Change Directory
mkdir
Make Directory
touch
Create empty file
cat
Display file contents
rm
Remove file/folder
help
Show all commands
Practice Terminal - Try Everything!
Keep Learning!
Type help in the terminal to see ALL available commands. There's so much more to explore!

Terminal Navigator!

You've learned the essential commands that every developer, sysadmin, and power user needs. The command line is now your superpower!

0
Commands Learned
0
Commands Tried
0
Time Exploring

pwd Shows Location

"Print Working Directory" tells you exactly where you are in the filesystem.

ls Lists Contents

See what files and folders exist in any directory.

cd Changes Directory

Navigate anywhere with paths - use .. to go up, / for absolute paths.

mkdir Creates Folders

"Make Directory" creates new folders wherever you need them.

touch Creates Files

Quickly create empty files or update timestamps.

cat Reads Files

Display the contents of any text file instantly.

Ready to Create?

Put your new knowledge into practice!

Suggest a Correction