Files, directories, and location

Lesson 6 of 30 · Working with Linux

A file stores data: its bytes might represent text, a photograph, or a program. A directory, also called a folder, contains names for files and other directories. A filesystem organizes these entries. Linux presents a directory tree beginning at /, the root directory; additional filesystems can be attached within that tree.

/                          root
└── home/
    └── learner/           example home
        └── linux-practice/
            └── field.txt

This is an illustration, not your actual home path. The first slash represents root; later slashes separate names. Root is different from the administrator account often called root.

Your shell has a working directory, its current location for resolving relative paths. pwd prints it. ls lists entries there, while ls ~ lists your home directory without moving into it. ls -a includes names beginning with a dot, which a plain listing normally hides, along with . and ... Listing a name does not display its contents. Results depend on the directory and access permissions.

Return to the practice directory created in chapter 1 with cd ~/linux-practice (substitute your chosen name). If that fails, stop and locate the saved path; do not create or change files elsewhere by mistake.