Shell Where You Are
Where you are means the folder the shell is in now. pwd prints it, and ls lists it.
Print the folder
pwd prints the folder you are in.
cd /tmp
pwdList a folder
ls lists the files in a folder.
ls docsList photos
ls photos lists the photo files.
ls photosExample
ls docs
ls photos
cd /tmp
pwdKey points
- pwd: the command that prints the folder you are in.
- ls: the command that lists the files in a folder.
- Use ls docs to list the files in the docs folder.
- ls names each file on its own line.
In this example, the first line lists the docs folder. The second line lists the photos folder. Then cd moves the shell to /tmp. Lesson 7 shows cd in full. Then pwd prints /tmp.
Try it Yourself
Edit the code, then press Run.
Running is simulated
Exercise
Which command lists the files in a folder?