Navigating directories
Covered topics: pwd
, ls
, absolute vs. relative paths, command flags, cd
, path shortcuts.
- pwd = Print Working Directory
- ls = LiSt everything inside the current/given directory
- cd = Change Directory
Click on a triangle to expand a question:
Relative vs. absolute paths. Using ~
as part of a longer path.

In the figure above, if pwd
displays /users/thing
, what will ls ../backup
display?
1. ../backup: No such file or directory
2. 2012-12-01 2013-01-08 2013-01-27
3. 2012-12-01/ 2013-01-08/ 2013-01-27/
4. original pnas_final pnas_sub
Given the same directory structure, if pwd
displays /users/backup
, and -r
tells ls
to display things in reverse order, what command will display:
pnas-sub/ pnas-final/ original/
ls pwd
ls -r -F
ls -r -F /users/backup
- Either #2 or #3 above, but not #1
What does the command cd
do if you do not pass it a directory name?
1. It has no effect
2. It changes the working directory to /
3. It changes the working directory to the user’s home directory
4. It produces an error message
Starting from /Users/amanda/data/
, which of the following commands could Amanda use to navigate to her home directory, which is /Users/amanda
? Mark all correct answers.
1. cd /
2. cd /home/amanda
3. cd ../..
4. cd ~
5. cd home
6. cd ~/data/..
7. cd
8. cd ..
Getting help
Covered topics: man
, navigating manual pages, --help
flag.
Check the manual page for ls
command: what does the -h
(--human-readable
) option do?