If you try to use an option (flag) that is not supported, ls
and other programs will usually print an error message similar to:
jupyter-user:~$ls -j
ls: invalid option -- 'j'
Try 'ls --help' for more information.
The -l
flag makes ls
use a long listing format, showing not only the file/directory names but also additional information such as the file size and the time of its last modification. The -h
flag makes the file size "human readable", i.e. display something like 5.3K
instead of 5369
.
The files/directories in each directory are sorted by time of last change.
We can see what is in the data
folder by passing the firectory name as an argument to ls
in the same way as before.
jupyter-user:~$ls -F IntroShell/data
shell-lession-data
Use the pwd
command we learned earlier:
jupyter-user:~$pwd
/jupyter/jupyter-user/IntroShell
`
We check the contents of the IntroShell
folder with again with ls
:
jupyter-user:~$ls
data
`
and then move into the directory with the cd
command:
jupyter-user:~$cd data
jupyter-user:~$pwd
/jupyter/jupyter-user/IntroShell/data
`
jupyter-user:~$ls
shell-lesson-data
jupyter-user:~$cd shell-lesson-data
jupyter-user:~$pwd
/jupyter/jupyter-user/IntroShell/data/shell-lesson-data
jupyter-user:~$ls -F
exercise-data/ north-pacific-gyre/
`
We can check where the special directory .
refers to by changing directory to it and issuing the pwd
command:
jupyter-user:$cd .
jupyter-user:$pwd
/jupyter/jupyter-user/IntroShell/data
jupyter-user:$pwd
/jupyter/jupyter-user/IntroShell/data/shell-lesson-data
jupyter-user:$cd /jupyter/jupyter-user/IntroShell
.
stands for the current directory./
stands for the root directory./Users/amanda
./Users
.~
stands for the user's home directory, in this case /Users/amanda
./Users
.Users/thing/backup
, but with ..
we asked for one level further up.../backup/
refers to /Users/backup/
.ls
Reading Comprehension
pwd
is not the name of a directory.ls
without directory argument lists files and directories in the current directory.