Independent tech guides — Useful tools — Made in Canada
Start with commands that only look

Linux terminal basics: find folders, read files and understand commands

The first useful terminal skill is knowing where you are and what a command will touch. You can practise that without installing software or changing system settings. This guide uses Ubuntu Desktop LTS and its usual Bash shell; terminal apps, keyboard shortcuts and shell features can differ on other Linux desktops.

DigitalMaple illustration

Open a terminal and recognise the prompt

Search your applications for Terminal. Ctrl+Alt+T also opens it on the standard Ubuntu desktop, although another desktop may use a different shortcut. The window is the terminal application; the shell inside it interprets what you enter. A different window theme does not necessarily mean different commands.

A tutorial may show a prompt such as user@computer:~$ before a command. Type the command after that prompt, without copying the prompt itself. Enter runs the line. Read the result before entering another line: successful commands sometimes print nothing, while an error usually tells you which assumption to check. These examples assume an ordinary account, not a root shell.

Ask where you are before choosing a path

Run pwd to print your working directory. That location matters whenever you give a relative path. A fresh window often starts in your home directory, but an editor's embedded terminal or a previously used window may start somewhere else. Looking first is more reliable than guessing from memory.

Run ls to list names in that directory. ls -la also includes names beginning with a dot and gives a longer listing. A dot-prefixed name is often an application's configuration or state; seeing it does not mean you should remove it. Listing a directory reads its names rather than opening every document inside.

Worked exampleRun pwd, then ls, then ls -la. Each is a separate command; none changes your files.

Build a small map of Linux paths

An absolute path starts at /, the root of the filesystem tree. A relative path starts from your working directory. The component . means the current directory and .. means its parent. Linux normally distinguishes uppercase and lowercase names, so Notes and notes can refer to different entries.

Use cd to change the shell's working directory. cd .. moves to the parent; cd with no argument returns to your home. A USB drive appears at a mount location in the same tree rather than acquiring a Windows-style drive letter. Its actual mount path depends on the desktop and device, so inspect it in Files before copying an example path.

ExampleHow to read it
/home/sam/NotesAbsolute example; sam is a placeholder account name.
NotesAn entry named Notes in the current directory.
../NotesAn entry named Notes in the parent directory.
$HOMEA shell variable containing your account's home path.

Keep a path with spaces together

The shell separates unquoted words before a program receives them. If a folder is named Project Notes, cd Project Notes supplies two arguments instead of one folder name. If that folder exists in your current directory, cd 'Project Notes' keeps its name together. Use straight keyboard quotes rather than decorative quotation marks copied from a document.

Double quotes keep a variable's expanded value together: ls -- "$HOME" lists your home directory even when its path contains spaces. Single quotes preserve text literally, so '$HOME' is the literal name $HOME rather than your home path. Do not put a tilde inside quotes and expect it to expand. For these examples, the quoted $HOME form is clearer.

COMMAND EXAMPLE · READ BEFORE RUNNING
ls -la -- "$HOME"

Read longer output with less

A pager lets you move through text without editing it. Try ls -la -- "$HOME" | less. The vertical bar sends ls output into less. Space moves forward a screen; q exits the pager and brings back your shell prompt. A short listing may fit on one screen and need little scrolling.

For an existing text file you are allowed to read, less -- /actual/path/to/file opens a paged view. Replace the whole example path with a real one. A document format such as a PDF is better opened in its usual viewer. A text reader is not a universal document converter, and an unfamiliar binary file is poor practice material.

Read a command as a small instruction

In ls -la -- "$HOME", ls is the program, -la combines two short options, and the quoted home path is its target. GNU ls accepts -- to end option processing, which also helps with a filename beginning with a dash. Options differ between programs: do not assume the same letter always means the same thing.

Use man ls to read the installed manual and q to leave its pager. Local manuals describe the version actually installed, while an online manual may document a newer release. Read a command's destination, overwrite behaviour and required privileges before running it. A copied line that downloads and executes a script deserves separate review of that script.

Finish with a read-only practice loop

Enter cd "$HOME", then pwd, then ls -- "$HOME". Next enter cd .. and pwd to see the parent; finish with cd to return home. Run each line individually and compare the displayed path with what you expected. This is enough practice to understand why the same relative filename can reach different places from different directories.

If a path is missing, check spelling, case and your current location. If access is denied, first ask whether that folder belongs to you and whether you need it at all. Adding sudo changes the authority of a command; it is not a general answer to an unfamiliar error. Stop before a command whose effect you cannot explain.

Sources & further reading

Documentation reviewed .

Ubuntu Desktop 26.04 documentation — The Linux command line for beginners ↗Ubuntu Server documentation — Command-line cheat sheet ↗GNU Coreutils — ls invocation ↗GNU Bash — Single Quotes ↗GNU Bash — Double Quotes ↗Ubuntu manpages — less(1) ↗

This guide is based on the sources linked above, with original explanations and examples. Software interfaces and service features can change. A documentation-based guide is not a hands-on product review. Read our editorial policy or report a correction.

Guides & toolsUse Tab to explore · Enter to open