🎓 A1Learner
🔍
0 of 50 lessons completed

Where You Are

A directory is a place that holds files. The current directory is the directory you are in now.

Where you are

Pwd prints the name of the current directory.

$ pwd

What is inside

Ls lists the names inside the practice directory.

$ ls ~/practice

Inside a smaller directory

Ls lists the names inside the notes directory.

$ ls ~/practice/notes

The whole shape

Tree draws the practice directory and all that sits below it.

$ tree ~/practice

Example

$ pwd
$ ls ~/practice
$ tree ~/practice/notes

Key points

  • A directory holds files in one place.
  • A folder is another name for a directory.
  • A file is one named piece of work, like a list or a report.
  • Use pwd to print the name of the current directory.
  • Use ls to list the names inside a directory.
  • Use tree to draw the shape of a directory and its contents.
  • The practice directory is the directory this course uses for every lesson.

In this example, three lines ask three facts. The first line gives the current directory. The second line lists its names. The third line draws the notes directory. The notes directory holds two files.

Note

Ls shows names only. It does not show what is inside each file.

Try it Yourself

Edit the code, then press Run.

Running is simulated

Exercise

What does pwd print?