Why ask where you are?
Every command you type runs inside one folder, called the working directory. When you type ls, it lists that folder. When you type cat notes.txt, the shell looks for notes.txt in that folder and nowhere else. If you’re in the wrong place, a perfectly good command fails, or worse, it works on the wrong files.
The prompt gives you a short version of the answer, such as you@laptop:~/bird-club$. That’s enough most of the time. When you need the exact answer, or when the prompt has been set up to hide it, as it often is on servers, pwd prints the full path. Checking costs one word and two seconds, and it’s the habit that prevents most beginner mistakes.
What does pwd print?
pwd stands for print working directory. In the practice terminal, straight after it opens, it prints /home/you. Read that path from the left. The first / is the root, the top of the whole computer. home is a folder inside the root that holds every user’s home folder. you is your home folder inside that.
This is called an absolute path, because it starts at / and describes the location from the very top. It means the same thing whatever folder you’re in. The ~ you see in the prompt is shorthand for exactly this path, so ~/bird-club and /home/you/bird-club name the same folder.
On a Mac your home folder is /Users/yourname instead of /home/yourname, and on a cPanel host it’s often /home/accountname. The idea is identical: pwd tells you, and you don’t need to guess.
$ pwd
/home/youWhat does ls show, and what does it leave out?
ls lists the names in the working directory. Give it a folder name, as in ls photos, and it lists that folder instead without moving you there. In the practice terminal, folders get a trailing / so you can tell them apart. A real terminal usually shows folders in a different colour instead; on many systems ls -F adds the slash.
By default ls sorts names alphabetically and leaves some things out. Any name that starts with a dot is skipped. That’s the whole rule: no special flag on the file, no special location. In the bird club folder, plain ls shows members.txt photos/ walks.txt, and the walk leaders list is nowhere to be seen.
$ cd bird-club
$ ls
members.txt photos/ walks.txtWhat are hidden dot files?
A dot file is any file or folder whose name begins with .. Programs use them for settings, so your home folder doesn’t fill up with clutter you rarely need to see. Your shell reads ~/.bashrc when it starts. Git keeps its whole history in a folder called .git. Websites often have a .htaccess file that changes how the server behaves, and projects often keep secrets in a .env file.
ls -a shows everything, dot files included. Run it in bird-club and .walk-leaders appears. ls -a also lists . and .., which stand for this folder and the folder above it. ls -A shows the dot files without those two.
Hidden doesn’t mean protected. Anyone who can read the folder can read a dot file. Treat them as tidied away, nothing more. When you upload a website, check with ls -a that you’re not sending a .env file full of passwords along with it.
$ ls -a
. .. .walk-leaders members.txt photos/ walks.txt
$ cat .walk-leaders
March walk leaders
Mill Pond: Ruth
River Walk: Dev

How do you read an ls -l line?
ls -l switches to the long format, one item per row with the details spread across columns. Here’s a row from the bird club folder: -rw-r--r-- 1 you you 40 Mar 22 09:11 members.txt. Read it left to right.
The first character is the type: - for a file, d for a folder, l for a link. The next nine characters are permissions in three groups of three, for the owner, the group and everyone else: r read, w write, x execute, - for no. The Permissions lesson covers them properly. Then comes a link count you can ignore for now, then the owner (you) and the group (you).
After that is the size in bytes, 40, then the date and time the file was last changed, then the name. A folder’s size is usually 4096, the space for its list of names, and has nothing to do with how much is inside it. The total line at the top is a count of disk blocks used; nobody reads it, and the practice terminal’s number is made up.
$ ls -l
total 24
-rw-r--r-- 1 you you 40 Mar 22 09:11 members.txt
drwxr-xr-x 1 you you 4096 Mar 15 09:14 photos
-rw-r--r-- 1 you you 58 Mar 1 09:12 walks.txtHow do you make sizes readable?
Raw byte counts are hard to judge. Is 2516582 big? Add -h, for human-readable, and ls turns it into 2.4M. K means kibibytes (1,024 bytes), M mebibytes, G gibibytes. -h only changes anything alongside -l, because plain ls doesn’t print sizes at all.
Short options can be combined behind one dash, in any order: ls -lh, ls -hl and ls -l -h all do the same thing. ls -lah is a common one to type from memory: long format, all files, readable sizes. Folders show as 4.0K, as they do in GNU ls.
$ ls -lh photos
total 11192
-rw-r--r-- 1 you you 2.4M Mar 22 09:15 heron-mill-pond.jpg
-rw-r--r-- 1 you you 340K Mar 1 09:16 wren.jpgWhich other ls options are handy?
ls -t sorts newest first, which answers “what did I change last?”. ls -S sorts largest first, handy when a disk is full. ls -r reverses whichever order you asked for, so ls -ltr puts the newest file at the bottom, right above your prompt. ls -1 prints one name per line, which is easier to read with long names. ls -R lists every folder inside, too, and can scroll for a long time in a big project.
On a Mac, ls comes from BSD and most of these letters mean the same thing. Colours need ls -G there instead of being on by default, and a few long options such as --group-directories-first only exist in the GNU version used on Linux servers.
What do AI tools get wrong here?
Assistants often tell you to edit .htaccess, .env or .bashrc and assume you can see them. Then a plain ls shows nothing and it looks like the file is missing. Use ls -a before you conclude a file doesn’t exist, and before you create a second copy of one that does.
They also read sizes loosely. A reply might call a folder small because ls -l shows 4096 next to it, but that number is the folder entry, never its contents. Measuring what’s inside a folder needs du -sh, which comes up later in the course. Last, check paths in their answers against pwd: a suggestion written for /var/www/html won’t help when your site lives in ~/public_html.
Field notes
- Every command runs inside one folder, called the working directory.
ls -aalso shows names that start with a dot, which are hidden by default.ls -lgives one row per item with permissions, owner, size and date.- Adding
-hturns large byte counts into sizes like 2.4M that are easy to read.
Easy to get wrong
Plain ls skips every name that starts with a dot, so .htaccess or .walk-leaders look missing when they’re there.
The dot is part of the name. Leave it off and the shell looks for a different file that doesn’t exist.
-h only formats sizes, and plain ls doesn’t show sizes. Pair it with -l.
Questions people ask
Why does my prompt not show the folder?
Prompts are configurable, and some servers show only the user and host. pwd always gives the full answer, whatever the prompt looks like.
Are dot files dangerous to delete?
Some are. Deleting .bashrc resets your shell settings, and deleting .git throws away a project’s whole history. Look inside with cat before you remove one you don’t recognise.
What is the difference between `ls -a` and `ls -A`?
-a shows every name, including . and ... -A shows the dot files but leaves out those two, here and on a real system.
Can I see hidden files in Finder or File Explorer?
Yes. In Finder press Cmd, Shift and the full stop together. In Windows File Explorer, turn on Hidden items in the View menu.