A path is the name of one file or directory, written as the way down the tree to it.
/the roothomedirectory/learnerdirectory/shopdirectory/prices.txtthe file
- /
- home
- learner
- shop
- prices.txt
- The first
/means: start at the root directory. - Each other
/separates one name from the next. - The last name is the item. It can be a file or a directory.
Use a path as an argument
Any command that takes a file name also takes a path. The file can be anywhere in the tree:
text
learner@tidepool:~$ cat /home/learner/shop/prices.txt
tea 4.50
coffee 3.20
learner@tidepool:~$ cat /etc/hostname
tidepoolThe file /etc/hostname holds the name of the computer. It agrees with the prompt.
tree also takes a path. It draws that directory:
text
learner@tidepool:~$ tree /home/learner/shop
/home/learner/shop
|-- orders
| |-- monday.txt
| `-- tuesday.txt
`-- prices.txt
1 directory, 3 filesUppercase and lowercase
Names are the same as commands: uppercase and lowercase letters are different. /home/learner/Shop and /home/learner/shop are two different paths.