A Linux terminal is the text interface; the shell interprets command lines; and commands perform work. Begin by identifying the actual terminal, shell, current directory, user, and command implementation. Then practice paths, quoting, help, and exit status as a normal user in a disposable folder.
This article uses commands commonly available on Linux and demonstrates Bash quoting. Your distribution or course may use Bash, Zsh, Fish, or another shell. Do not assume their startup files and syntax are identical.
Inventory the active environment
Open the terminal application supplied by your desktop or course environment. Run:
whoami
pwd
printf '%s\n' "$SHELL"
ps -p "$$" -o comm=
Record the terminal application’s name separately. $SHELL commonly identifies
the login shell recorded for the account, while ps -p "$$" -o comm= inspects
the current shell process. They can differ after starting another shell or
entering a managed environment.
Do not copy a leading $ or # from documentation unless it is explicitly
part of the command. Those characters often represent prompts. A # prompt is
also commonly associated with privileged shells, but prompt appearance is
configurable. Verify identity with whoami or id.
Read Linux paths from the root
Linux paths use / as the component separator:
/home/student/college/cs101/project/README.md
A path that starts with / is absolute. A path without it is relative to the
current working directory. The Linux
path_resolution(7) manual
explains how the kernel starts at the process root for an absolute path and at
the current directory for a relative path.
Useful locations often include:
| Path | General role |
|---|---|
/ |
Root of the filesystem hierarchy |
| Your home directory | Personal files and user-specific configuration |
/etc |
Host-specific system configuration |
/usr |
Shareable, read-only programs and data in the FHS model |
/var |
Variable data such as caches, queues, and logs |
/tmp |
Temporary files; retention and access policy vary |
The Filesystem Hierarchy Standard
defines common placement conventions, but distributions, containers,
network-mounted homes, and application packaging can differ. Query the home
directory through the account environment rather than assuming /home/name.
Practice navigation in a safe tree
Create a disposable tree under your home directory:
mkdir -p "$HOME/linux-shell-practice/course notes/week 1"
cd "$HOME/linux-shell-practice"
pwd
ls
Then navigate with a relative path:
cd "course notes/week 1"
pwd
cd ..
pwd
.. refers to the parent directory. . refers to the current directory.
Before a command writes or removes data, run pwd and inspect the target.
Linux filenames are case-sensitive on common native filesystems:
README.md and readme.md can be distinct. Hidden names conventionally begin
with a dot, such as .config. Use ls -a to include them in a listing, but do
not edit an unfamiliar dotfile merely because it became visible.
Quote one argument correctly
The shell parses a command line before the command receives arguments. Without quotes, spaces separate words:
ls course notes
That normally passes two arguments, course and notes. To pass one path:
ls "course notes"
The GNU Bash manual explains that quoting removes special meaning from characters or words. In Bash:
- single quotes preserve every character inside them literally;
- double quotes still permit selected expansions such as
$HOME; and - a backslash can quote the next character in supported contexts.
Compare:
printf '%s\n' '$HOME'
printf '%s\n' "$HOME"
The first prints the literal characters $HOME; the second prints the expanded
value. Never place an untrusted string into a command merely by adding quotes;
quoting is a parsing tool, not a trust decision.
Ask the installed command for help
Identify what the shell will run:
type pwd
type ls
type cd
A name can resolve to a shell builtin, alias, function, or executable. Use the matching help source:
help cd
man ls
ls --help
help is a Bash builtin for Bash builtins. man opens installed manual pages.
Many GNU commands support --help, but the option is not universal. Follow the
command’s own documentation.
When a manual page opens, use its pager’s documented keys. Common pagers use
Space to move forward and q to quit, but local configuration can differ.
Check output and exit status
A successful command can print nothing, and a failed command can print useful output. In Bash, inspect the most recent pipeline’s status immediately:
ls "$HOME/linux-shell-practice"
printf 'status=%s\n' "$?"
Zero conventionally indicates success. Nonzero meanings belong to the command’s
documentation. Running another command replaces $?, so record it immediately.
Do not treat exit status alone as proof. Also inspect the expected files or output and confirm that the command targeted the intended directory.
Delay shell customization
Interactive Bash commonly reads user startup files such as ~/.bashrc, while
login-shell behavior uses a different startup sequence. The
Bash startup-file documentation
describes the distinctions.
Do not paste a large prompt, alias, PATH, or framework configuration into a
startup file during this exercise. A broken startup file can affect every new
shell. Shell configuration and reproducible dotfiles belong in the later Linux
setup article.
Common mistakes
- Calling the terminal application and shell the same component.
- Assuming
$SHELLalways names the running process. - Typing the prompt symbol shown in documentation.
- Navigating by guesswork instead of checking
pwd. - Leaving paths with spaces unquoted.
- Assuming Bash syntax applies unchanged to every Linux shell.
- Editing hidden startup files before understanding when they load.
- Reading output without checking status and resulting state.
- Practicing routine commands in a root shell.
Do this now
Complete the environment inventory and disposable-tree exercise. Use type and
one local help mechanism for a read-only command. Predict one output, run the
command, and record its immediate exit status. Use no sudo.
Log what you learned
The environment inventory and disposable-tree exercise are the learning log. Save the predicted and observed output, immediate exit status, and next question there.
Next, learn how to install and update Linux packages deliberately using the package manager documented for your distribution.