Hone

Lessons · Terminal · where am I

Where am I?

The shell always has a current folder. pwd prints its full path, and every command you type runs from there.

Hone is a place to practise programming. This is one of its lessons, written out in full and free to read without an account.

What it is for

Half of all confusing errors on the command line are 'no such file' from a folder you did not think you were in. One command settles it.

How to think about it

When anything is unexpected, ask where you are before asking what went wrong. Read the path from the left: each slash is a folder inside the last.

Worked example

mkdir -p demo/notes
A folder to explore, with one inside it.
cd demo/notes
Move into the inner one.
pwd
Prints the full path, ending in /demo/notes: that is where you are.

Your turn

Print the folder you are in.

The trap

Assuming you are where you were a minute ago. A cd in a script, or an earlier command, may have moved you.

Practise where am I on HoneA question on it now, a coding challenge where there is one, and it is remembered for review. Free, no email needed.