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.

  1. Concepts
  2. Questions
  3. Sort and link
  4. Scenarios
  5. 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: or D: 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/lea

    Each .. goes up one level: from web to projets, then to lea. pwd always 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 /root apart lets root log in even when the partition holding /home is 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, fstab or ssh/sshd_config: text files, edited by root.

  • In /home/lea, the command cat /docs/notes.txt answers “cat: /docs/notes.txt: No such file or directory”, although the file is in Léa's docs folder. 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.txt

    With the leading /, the path starts at the root and looks for a /docs directory that does not exist. Without it, it starts at the current directory (~/docs/notes.txt works too). sudo cannot create what does not exist, and ../docs would look in /home/docs.