The Linux Directory Structure
• A structure that organizes files is necessary to make it easier to find and manipulate data
and run programs
• Linux uses a logical directory tree to organize files into directories
• When a user stores files in a certain directory, files are physically stored in the filesystem
of a certain partition.
• The absolute pathname to a file or directory is the full pathname of a certain file or
directory starting from the root directory
• Linux structure contains a single root (referred to using /), with different filesystems on
hard drive partitions mounted to different directories on the directory tree.
Changing Directories
• When logged in, you are placed in your home directory
o a place unique for the user for storing personal files
o regular users usually have a home directory named after their user account under
the /home directory.
o Regardless of your user name, you can always use the ~ metacharacter to refer to
the home.
• You can use `pwd` (print working directory) command to confirm the system directory
you’re currently in.
• You can use the cd (change directory) command with an argument to change directory.
o If destination not specified, it returns you to your home directory
• A relative pathname is the pathname of a target file or directory relative to you current
directory in the tree.
o To refer to a directory one step back on the tree (parent directory) use two dots ...
• BASH shell uses Tab-completion feature when typing pathnames as arguments to
commands.
, Viewing Files and Directories
File types
• A linux system can have several types of files:
o text files
o binary data files
o executable program files
o directory files
o linked files
o special device files
o Named pipes and sockets
• Most files that contain configuration information are text files.
• A program is typically associated with several supporting binary data files
o store information such as common functions and graphics
• Linked files are files associated with another.
o they can represent the same data
o they can point to another files (also known as shortcut file)
• Special device files are less common than other file types
o represent different devices on the system
• Named pipe files identify channels that pass info from one process in memory to another.
• A variant of the pipe file is a socket file.
o allows a process on another computer to write a file on the local computer while
another process read from that file.
Filenames
• Files are recognized by their filenames
o can include up to 255 characters
o rarely longer than 20 characters
• Filenames that start with a period (.) are hidden files.
• The characters at the end of the filename indicate the file type