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.
pwdThe pwd command means print working directory. It shows your current location in the filesystem.
pwd
/home/devops/projects/apiThis matters because many commands use relative paths. If you are in the wrong directory, the same command may fail or affect the wrong file.
lsThe ls command lists directory contents.
ls
ls -l
ls -la
ls -lhUseful flags:
-l shows a long listing format-a includes hidden files like .bashrc-h shows readable sizes such as 4K or 12MExample:
ls -lah /etc/nginxThis shows permissions, owners, sizes, and hidden entries inside /etc/nginx.
Tip: Hidden files in Linux usually start with a dot, such as
.gitignoreor.env.
cdThe cd command means change directory.
cd /var/log
cd ..
cd ~
cd -Useful patterns:
cd .. goes up one levelcd ~ goes to your home directorycd - returns to the previous directoryA real example:
cd /etc
cd nginx
cd ../sshThis is faster than typing every full path from scratch.
treeThe 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.
fileThe file command tells you what a file actually is.
file /bin/bash
file /etc/hosts
file app.tar.gzThis is helpful when extensions are missing or misleading. A file called backup could be plain text, a gzip archive, or a binary.
which and whereiswhich shows the executable path that your shell will run.
which bash
which python3Example output:
/usr/bin/bashwhereis looks more broadly for a commandâs binary, source, and manual pages.
whereis bash
whereis sshUse which when you want the exact command path the shell uses. Use whereis when you want extra related locations.
manThe man command opens manual pages.
man ls
man chmodManual 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.
helpThe help command explains shell built-ins.
help cd
help pwdThis is different from man. Commands like cd are often shell built-ins, so help may be more accurate than man for them.
Imagine you need to inspect an application directory:
pwd
ls -lah
cd /opt/myapp
tree -L 2
file deploy.sh
which bash
man grepThis workflow answers several questions quickly:
Running rm config.yaml is risky if you are not sure where you are. Use pwd first.
Beginners often use ls and assume nothing else exists. But .env, .ssh, and .git are hidden unless you include -a.
Guessing flags is slower than using man or help. Linux rewards curiosity.
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?
<MCQExercise exercise={{
id: 'linux-navigation-q1',
title: 'Exercise 1: Listing hidden entries',
description: 'Choose the ls option that reveals dotfiles and other hidden entries.',
options: [
{ id: 'a', text: '-a' },
{ id: 'b', text: '-t' },
{ id: 'c', text: '-r' },
{ id: 'd', text: '-s' },
],
correctId: 'a',
explanation: 'The tutorial explains that ls -a includes hidden files whose names begin with a dot. That is why it is the right tool when important entries like .git or .env are missing from a normal listing.',
wrongExplanations: {
b: '-t changes sorting behavior by time, but it does not reveal hidden files.',
c: '-r reverses sort order. It does not include dotfiles on its own.',
d: '-s is not the flag the lesson introduced for hidden entries. The tutorial specifically pointed to -a.',
},
}} />
Question: If you want the exact executable path your shell will run for python3, which command is the best fit?
<MCQExercise exercise={{
id: 'linux-navigation-q2',
title: 'Exercise 2: Choosing which versus whereis',
description: 'Pick the command that shows the executable path your shell will use.',
options: [
{ id: 'a', text: 'whereis python3' },
{ id: 'b', text: 'tree python3' },
{ id: 'c', text: 'which python3' },
{ id: 'd', text: 'file python3' },
],
correctId: 'c',
explanation: 'The lesson distinguishes which from whereis: which shows the executable path the shell will actually run. That makes it the most precise choice when you want the command path in use.',
wrongExplanations: {
a: 'whereis searches more broadly for binaries, source, and manuals, but it is not the most exact answer for what the shell will execute.',
b: 'tree visualizes directories. It does not resolve commands in your PATH.',
d: 'file identifies file types, not which executable location your shell will choose.',
},
}} />
Question: Why did the tutorial recommend help cd instead of relying only on man cd?
<MCQExercise exercise={{
id: 'linux-navigation-q3',
title: 'Exercise 3: Getting help for built-ins',
description: 'Identify why the help command can be more accurate for cd.',
options: [
{ id: 'a', text: 'Because help edits the current directory for you.' },
{ id: 'b', text: 'Because cd is usually a shell built-in, so help can describe it more directly.' },
{ id: 'c', text: 'Because man pages cannot exist on Linux systems.' },
{ id: 'd', text: 'Because help shows file permissions instead of documentation.' },
],
correctId: 'b',
explanation: 'The tutorial notes that commands like cd are often built into the shell rather than separate executables. In those cases, help can be the most direct and accurate documentation source.',
wrongExplanations: {
a: 'help only explains built-ins. It does not perform navigation actions for you.',
c: 'Linux absolutely can have man pages. The point was that help is sometimes better for shell built-ins, not that man is impossible.',
d: 'Displaying permissions is the job of tools like ls -l, not help.',
},
}} />
pwd when lost, cd - to jump back to the previous directory.ls -lah is the one to memorise: long format, hidden files, human-readable sizes./; a relative one does not. Scripts should use absolute.~ is your home directory, and ~user is someone else's.which finds a command on PATH; type also reveals aliases and shell builtins.man searches with /, navigates with n, and quits with q: the same keys as less.Left to right: the permission string, link count, owner, group, size in bytes, modification time, and name. The permission string's first character is the file type, - for a regular file, d for a directory, l for a symlink, followed by three groups of rwx for user, group and other. Add -h for human-readable sizes and -a to include hidden files, which is why ls -lah is the form worth committing to muscle memory.
Returns you to the previous directory, toggling between two locations. Invaluable when moving repeatedly between a config directory and a log directory. cd with no argument goes home, and cd .. goes up one level. For deeper movement, pushd and popd maintain a stack of directories, and dirs -v lists it. Most of the time cd - plus tab completion covers everything you need.
which searches your PATH and prints the executable that would run. whereis additionally locates the binary, source and man page from a system database. type is a shell builtin and the most informative, because it reveals things which cannot see. Whether the name is an alias, a shell function, or a builtin. When which python says one thing and the command behaves like another, type python explains why.
Man pages open in less, so /pattern searches, n and N move between matches, g and G jump to start and end, and q quits. Rather than reading top to bottom, search for the flag you care about, /--exclude, since the options section is where the answers are. man -k <keyword> searches all page descriptions when you do not know the command name. tldr is worth installing for a short page of practical examples instead of the full reference.
The program is not in a directory on your PATH. Check with echo $PATH and confirm where it actually landed using ls /usr/local/bin or find / -name <program> 2>/dev/null. Fix it by adding the directory in ~/.bashrc with export PATH="$PATH:/opt/tool/bin", then opening a new shell or running source ~/.bashrc. The other common cause is installing with a package manager whose install location is not on PATH, such as a user-level pip install putting binaries in ~/.local/bin.
Copy, move, delete and read files safely on Linux: why rm has no undo, cp -r versus cp -a, the trailing-slash trap, find by name and size, less versus tail.
Use grep, sed, awk, sort and uniq for real work: pick the right tool for each question, avoid the sed -i portability trap and see why errors vanish in pipes.
Understand Linux permissions: rwx for user, group and other, octal modes like 755 and 644, chmod versus chown, setuid, the sticky bit and umask defaults.