🎓 A1Learner
🔍
0 of 50 lessons completed

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
pwd

List a folder

ls lists the files in a folder.

ls docs

List photos

ls photos lists the photo files.

ls photos

Example

ls docs
ls photos
cd /tmp
pwd

Key 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?