Moving and Looking

Three commands do all of the navigating.

pwd prints where you are.

cd changes where you are.

ls lists what is around you.

That is genuinely the whole toolkit. Everything else in this course assumes you can move.

Useful forms of cd.

cd projects goes into a subdirectory.

cd .. goes up one level.

cd ../.. goes up two.

cd / goes to the root.

cd with no argument goes home, which is the fastest way out of anywhere confusing.

✦ ls -l is worth learning to read

The long listing shows permissions, size and name for each entry. The first character tells you the kind: d for a directory, a dash for an ordinary file. The next nine characters are the permission bits, which get a module of their own later. For now, notice that a directory announces itself as a directory, which saves you from trying to cat one.

SANKOFA SANDBOX
learner:~$

Try ls -l here and compare it with plain ls.

Try it → From your home directory, run `ls -l projects`. Then `cd logs` and run `ls -l`. Notice you can list a directory without moving into it, which is often quicker.

◈ Graded Task

Navigate to the archive project and stay there. Along the way, prove you can reach it by a relative path rather than typing the whole absolute one, and list the contents of the map project without moving into it.

Checked against the filesystem you leave behind, not the commands you type, so any route that gets the job done counts. 3 visible and 2 hidden checks.

SANKOFA SANDBOX
learner:~$

Mark this lesson complete

Signed in, your progress follows you to every device.

Next: Practice Test →
← Back