Filesystem
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:
Question 2.1
Relative vs. absolute paths. Using~
as part of a longer path.
Question 2.2
In the figure above, if pwd
displays /users/thing
, what will ls ../backup
display?
../backup: No such file or directory
2012-12-01 2013-01-08 2013-01-27
2012-12-01/ 2013-01-08/ 2013-01-27/
original pnas_final pnas_sub
Question 2.3
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
Question 2.4
What does the command cd
do if you do not pass it a directory name?
- It has no effect
- It changes the working directory to /
- It changes the working directory to the user’s home directory
- It produces an error message
Question 2.5
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.
cd /
cd /home/amanda
cd ../..
cd ~
cd home
cd ~/data/..
cd
cd ..
You can watch a video for this topic after the workshop.
Getting help
Covered topics: man
, navigating manual pages, --help
flag.
$ man ls
$ ls --help
Question `-h`
Check the manual page forls
command: what does the -h
(--human-readable
) option do?
You can watch a video for this topic after the workshop.