Linux Basic Commands: A Visual Survival Guide

Master the 20 essential Linux commands for file navigation, management, and system monitoring. The absolute foundation for DevOps.

Linux Basic Commands: A Visual Survival Guide
📧

Get weekly IT guides

Join 5,000+ IT professionals

Subscribe Free
Linux filesystem hierarchy starting from root /
The file system structure

The terminal (black screen) scares people. But it’s faster, more precise, and more powerful than any mouse click. Once you know these 20 commands, you’ll feel like a wizard.

Introduction

Linux is everywhere — servers, clouds, android phones, and even Mars rovers. They all speak the same language: Bash. This guide covers the “Survival Kit” — the commands you will use 99% of the time.

What You'll Learn
  • How to navigate folders (cd, ls, pwd)
  • How to create, move, and copy files (touch, cp, mv)
  • How to read files (cat, less, head)
  • How to become the superuser (sudo)

1. Navigation (Moving Around)

Imagine you are an explorer in a maze of folders.

pwd — “Where am I?”

Print Working Directory. Tells you your absolute path.

pwd

Show current directory path

beginner

ls — “What’s in here?”

List generic files.

ls

List files in current folder

beginner
ls -l

List with details (permissions, size, owner)

beginner
ls -a

List ALL files (including hidden .dotfiles)

beginner

cd — “Take me there”

Change Directory.

cd Downloads

Go into Downloads folder

beginner
cd ..

Go UP one level (parent folder)

beginner
cd ~

Go home (/home/user)

beginner
cd /

Go to root (very top)

beginner

2. File Manipulation (The Tools)

mkdir — Create Folder

mkdir my-project

Make a new directory

beginner

touch — Create File

touch notes.txt

Create an empty file

beginner

cp — Copy

cp file.txt copy.txt

Copy file.txt to copy.txt

beginner
cp -r folder/ backup/

Copy a whole FOLDER (recursive)

beginner

mv — Move (or Rename)

Linux doesn’t have a “rename” command. You just “move” the file to a new name.

mv file.txt newname.txt

Rename file.txt to newname.txt

beginner
mv file.txt Documents/

Move file.txt into Documents folder

beginner

rm — Remove (Delete)

Warning: No Recycle Bin

rm is permanent. There is no “Trash Can”. Once you run it, the file is gone forever.

rm junk.txt

Delete a file

beginner
rm -r old-folder

Delete a folder and everything inside it

beginner

3. Reading Files

cat — Dump everything

Concatenate. Dumps the whole file to the screen. Good for small files.

cat config.txt

Print file content to terminal

beginner

less — Scrollable View

Good for huge log files. Use arrow keys to scroll, q to quit.

less huge-log.log

Open file in read-only scrolling mode

beginner

head / tail — Peek

head -n 5 file.txt

Show first 5 lines

beginner
tail -n 5 file.txt

Show last 5 lines (great for logs)

beginner

4. Search and System Info

grep — Find text

Global Regular Expression Print. Search for a word inside files.

grep 'error' syslog

Find lines containing 'error' in syslog

beginner

man — The Manual

Stuck? Ask the manual.

man ls

Show manual page for ls command (q to quit)

beginner

sudo — “God Mode”

SuperUser DO. Run a command with admin privileges.

sudo apt update

Run update as root user

beginner

Hands-On Challenge

Open your terminal and try this sequence:

cd ~
mkdir flight-mission
cd flight-mission
touch plan-a.txt
touch plan-b.txt
mv plan-b.txt final-plan.txt
rm plan-a.txt
ls
# Output should basically be just final-plan.txt

Quiz: Test Your Knowledge

🧠

Test Your Knowledge

Take a quick 5-question quiz to check your understanding.

📧

Get weekly IT guides

Join 5,000+ IT professionals

Subscribe Free
Type to start searching...