In Chapter 2, you read files from "the folder that the shell is in". On Linux, a folder is a directory. A directory holds files and other directories.
One tree
All of the directories on a Linux computer make one tree. The top of the tree is the root directory. Its name is one slash: /.
- /
- etc
- hostname
- home
- learner
- notes.txt
- shop
- prices.txt
- orders
- monday.txt
- usr
- var
Each step to the right is one level down. notes.txt is in learner. learner is in home. home is in /.
There is only one tree. On Windows, each disk has a letter, such as C:. On Linux, there are no disk letters. Everything is under /.
The command tree
tree draws the directory that the shell is in, and everything under it:
learner@tidepool:~$ tree
.
|-- notes.txt
`-- shop
|-- orders
| |-- monday.txt
| `-- tuesday.txt
|-- prices.txt
`-- reports
|-- week-40.txt
`-- week-41.txt
3 directories, 6 filesThe first line, ., stands for the directory that the shell is in. The lesson "Relative Paths" explains it. The last line counts the directories and the files under the start. tree counts all levels, not only the first.
Two meanings of "root"
| You see | It means |
|---|---|
/ | The root directory, the top of the tree |
root before the @ in the prompt | The administrator account (Chapter 1) |
The word is the same. The two things are different.