File types, inodes and links

The seven file types shown by ls -l, what an inode holds, the directory as a table of names, hard and symbolic links, the link count, and the failures that follow from them.

  • 25 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. The numbers
  5. Scenarios

A few cards from the deck

  • Inode: what is it?

    Show the answer

    The file system structure that holds a file's metadata (owner, permissions, size, dates, location of the data), but not its name.

    The name lives in the directory, which maps it to an inode number; ls -i shows that number and stat details the rest.

  • What does the last command print?

    ```bash
    echo bonjour > a
    ln a b
    rm a
    cat b
    `

    • bonjour
    • cat: b: No such file or directory
    • An empty line: the content went away with a
    • cat: b: Stale file handle
    Show the answer

    bonjour

    b is a second name for the same inode. rm a removes one name and lowers the count from 2 to 1: the data stays readable through b.

  • A directory is a table that maps … to … numbers.

    Show the answer

    A directory is a table that maps names to inode numbers.

    That is why renaming or moving a file within one file system copies nothing: a directory entry changes, the inode stays the same.

  • Hard link: what is it?

    Show the answer

    An extra directory entry that points straight at the inode of an existing file: two names, one file.

    Neither name is the original. The data only goes away with the last name, and the link cannot cross a file system.