The Linux directory tree
The root and the standard directories (/etc, /var, /home, /usr, /dev, /proc, /tmp…), the difference between absolute and relative paths, and the meaning of “.”, “..” and “~”.
- 31 cards
- 5 topics
- Free
The outline, topic by topic
Each topic is weighted the way the exam weighs it.
- Concepts
- Questions
- Sort and link
- Scenarios
- Understand
A few cards from the deck
Linux directory tree: what is it?
Show the answer
The single tree that holds every file of the system, starting from one top directory written
/.There are no
C:orD:drives: disks and USB sticks are attached to a directory of this tree.What is the current directory after these commands?
```bash
cd /home/lea/projets/web
cd ../..
pwd`/home/lea/home/lea/projets/home/home/lea/projets/web/..
Show the answer
/home/leaEach
..goes up one level: fromwebtoprojets, then tolea.pwdalways prints an absolute path, with no...Users' home directories live in …; the superuser's is …, outside /home.
Show the answer
Users' home directories live in /home; the superuser's is /root, outside /home.
Keeping
/rootapart lets root log in even when the partition holding/homeis not mounted./etc: what is it?Show the answer
The directory that holds the configuration files of the system and its services.
It holds for example
passwd,hosts,fstaborssh/sshd_config: text files, edited by root.In
/home/lea, the commandcat /docs/notes.txtanswers “cat: /docs/notes.txt: No such file or directory”, although the file is in Léa'sdocsfolder. Which fix?- Remove the leading
/:cat docs/notes.txt - Take root's rights:
sudo cat /docs/notes.txt - Add an option:
cat -r /docs/notes.txt - Go up a level first:
cat ../docs/notes.txt
Show the answer
Remove the leading
/:cat docs/notes.txtWith the leading
/, the path starts at the root and looks for a/docsdirectory that does not exist. Without it, it starts at the current directory (~/docs/notes.txtworks too).sudocannot create what does not exist, and../docswould look in/home/docs.- Remove the leading