DevOpsLesson
DevOpsLesson

Free, comprehensive DevOps tutorials and learning roadmaps. Master Docker, Kubernetes, CI/CD, and more.

Stay Updated

Get notified about new tutorials and features.

Tutorials

  • What is DevOps?
  • Docker Tutorial
  • Terraform Tutorial
  • CI/CD Pipeline
  • All Tutorials

Roadmaps

  • DevOps Engineer
  • Cloud Engineer
  • SRE Path
  • All Roadmaps

Company

  • About Us
  • Blog
  • Contact
  • Privacy Policy
  • Terms of Service

© 2026 DevOpsLesson. All rights reserved.

DOCKERKUBERNETESTERRAFORMAWSCI/CDLINUXGITDEVOPS ROADMAPCLOUD ROADMAPSRE ROADMAPGIT CHEATSHEETDOCKER CHEATSHEETK8S CHEATSHEETTF CHEATSHEETLINUX CHEATSHEETDOCKERFILE LINTERYAML VALIDATORCRON PARSERREGEX TESTER

Linux Tutorial

Introduction to Linux
Linux Filesystem
Linux Navigation
Linux File Operations
Linux Text Processing
Linux Permissions
Linux Users and Groups
Linux Process Management
Linux systemd Basics
Linux Networking
Linux Disk and Storage
Linux Bash Scripting
Linux Package Management
Linux Environment Variables
Linux Cron Jobs
Linux SSH Keys
Linux Firewall Basics
Linux Log Management
Linux Performance Monitoring and Troubleshooting

Linux Navigation

PreviousPrev
Next

Practice moving around the Linux command line with pwd, ls, cd, tree, file, which, whereis, man, and help.

Why Navigation Skills Matter

Before you can manage files, edit configs, or inspect logs, you need to know where you are and how to move around. Linux navigation commands are simple, but they form the foundation of almost every admin or DevOps task.

A common production workflow might involve jumping from a service config in /etc, to a binary in /usr/bin, to logs in /var/log, all within a few minutes.

Finding Your Current Location with pwd

The pwd command means print working directory. It shows your current location in the filesystem.

pwd
/home/devops/projects/api

This matters because many commands use relative paths. If you are in the wrong directory, the same command may fail or affect the wrong file.

Listing Files with ls

The ls command lists directory contents.

ls
ls -l
ls -la
ls -lh

Useful flags:

  • -l shows a long listing format
  • -a includes hidden files like .bashrc
  • -h shows readable sizes such as 4K or 12M

Example:

ls -lah /etc/nginx

This shows permissions, owners, sizes, and hidden entries inside /etc/nginx.

Tip: Hidden files in Linux usually start with a dot, such as .gitignore or .env.

Changing Directories with cd

The cd command means change directory.

cd /var/log
cd ..
cd ~
cd -

Useful patterns:

  • cd .. goes up one level
  • cd ~ goes to your home directory
  • cd - returns to the previous directory

A real example:

cd /etc
cd nginx
cd ../ssh

This is faster than typing every full path from scratch.

Visualizing Structure with tree

The tree command shows a directory as a tree structure.

tree
tree -L 2 /etc

-L 2 limits output to two levels deep, which keeps things readable.

If tree is not installed on a system, that is normal. Many minimal servers do not include it by default.

Identifying File Types with file

The file command tells you what a file actually is.

file /bin/bash
file /etc/hosts
file app.tar.gz

This is helpful when extensions are missing or misleading. A file called backup could be plain text, a gzip archive, or a binary.

Locating Commands with which and whereis

which shows the executable path that your shell will run.

which bash
which python3

Example output:

/usr/bin/bash

whereis looks more broadly for a command’s binary, source, and manual pages.

whereis bash
whereis ssh

Use which when you want the exact command path the shell uses. Use whereis when you want extra related locations.

Reading Documentation with man

The man command opens manual pages.

man ls
man chmod

Manual pages explain syntax, options, and behavior. They are one of the best ways to learn Linux directly from the system.

Search inside a man page by typing /pattern and press q to quit.

Note: Some containers and tiny images do not include man pages to save space.

Using Built-In Help with help

The help command explains shell built-ins.

help cd
help pwd

This is different from man. Commands like cd are often shell built-ins, so help may be more accurate than man for them.

A Small Hands-On Workflow

Imagine you need to inspect an application directory:

pwd
ls -lah
cd /opt/myapp
tree -L 2
file deploy.sh
which bash
man grep

This workflow answers several questions quickly:

  • where am I?
  • what files are here?
  • what is the directory structure?
  • what type of file is this?
  • which shell binary will run?
  • where can I learn more about a command?

Common Beginner Mistakes

Forgetting the Current Directory

Running rm config.yaml is risky if you are not sure where you are. Use pwd first.

Ignoring Hidden Files

Beginners often use ls and assume nothing else exists. But .env, .ssh, and .git are hidden unless you include -a.

Not Reading Built-In Docs

Guessing flags is slower than using man or help. Linux rewards curiosity.

Test Your Understanding

Let's see how well you understood the concepts! These exercises will help reinforce what you just learned.

Exercise 1: Listing hidden entries

Scenario: You suspect a directory contains .env and .bashrc files that plain ls does not show.

Question: Which command flag from the lesson should you add?

Exercise

Exercise 1: Listing hidden entries

Choose the ls option that reveals dotfiles and other hidden entries.

Exercise 2: Choosing which versus whereis

Question: If you want the exact executable path your shell will run for python3, which command is the best fit?

Exercise

Exercise 2: Choosing which versus whereis

Pick the command that shows the executable path your shell will use.

Exercise 3: Getting help for built-ins

Question: Why did the tutorial recommend help cd instead of relying only on man cd?

Exercise

Exercise 3: Getting help for built-ins

Identify why the help command can be more accurate for cd.

PreviousPrev
Next

Continue Learning

Introduction to Linux

Understand what Linux is, how the kernel, distribution, and shell relate, and why Linux matters in DevOps.

12 min·Easy

Linux Filesystem

Learn how the Linux filesystem is organized, what key directories do, and how to work with absolute and relative paths.

15 min·Easy

Linux File Operations

Learn how to create, copy, move, remove, link, and inspect files in Linux with safe, practical examples.

15 min·Easy

Explore Related Topics

Do

Docker Tutorials

Run and manage containers on Linux

Gi

Git Tutorials

Master Git version control on the command line

Try the Tool

Cron Parser

Parse and validate cron expressions with a visual schedule preview.

Regex Tester

Test and debug regular expressions used in Bash scripts and configs.

On This Page

Why Navigation Skills MatterFinding Your Current Location with `pwd`Listing Files with `ls`Changing Directories with `cd`Visualizing Structure with `tree`Identifying File Types with `file`Locating Commands with `which` and `whereis`Reading Documentation with `man`Using Built-In Help with `help`A Small Hands-On WorkflowCommon Beginner MistakesForgetting the Current DirectoryIgnoring Hidden FilesNot Reading Built-In DocsTest Your UnderstandingExercise 1: Listing hidden entriesExercise 2: Choosing which versus whereisExercise 3: Getting help for built-ins