Hone

Lessons · Terminal · moving between folders

Moving around

cd folder moves you into a folder. cd .. goes up one. cd on its own goes home. cd - goes back to where you were before.

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

Projects are trees of folders and every command runs from where you stand. Moving well is most of the skill.

How to think about it

Say the move out loud: into notes, up one, back to the last place. Then pwd if in any doubt.

Worked example

mkdir -p demo/src demo/docs && cd demo
A project with two folders.
cd src
Into src.
pwd
Ends in /demo/src.
cd ..
Up one.
pwd
Ends in /demo.
cd docs
Into docs.
cd -
Back to the previous folder, and it prints where you landed: /demo.

Your turn

Go up one folder.

cd 

The trap

cd with a path that has a space in it, unquoted. cd my notes tries to enter 'my' and complains about 'notes'.

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