Moving around · Going places with cd
Change directory
cd (short for change directory) moves you into another folder. From then on that folder is your working directory, so commands like ls work there.
Why: it's how you get around. Most work happens inside one project folder, and you cd there first.
How to type it: cd, a space, then the folder's name.
Worked example
learner@shellstreak:~$ cd projectsWhat happened
- No output at all. That's normal:
cdworks silently, and so do most commands that succeed with nothing to report. - Look at the prompt instead. It now reads
learner@shellstreak:~/projects$:~/projectsmeans the projects folder inside your home folder. pwdwould now print/home/learner/projects, andlswould listbudgetandwebsite.
Common mistakes
- Trying to
cdinto a file, likecd notes.txt. You can only go into folders: the terminal says Not a directory. - Getting the capitals wrong:
cd documentsfails, because the folder isDocuments. - Forgetting the space:
cdprojectsis an unknown command.
Tap Run to move into projects, then try ls there.
Try it:
cd projectslearner@shellstreak: ~
Starting your practice shell…
You can also type in the terminal yourself. Try anything: you can't break it.
Go deeper: Basic terminal commands for beginners