Docsity

Exploring Linux File Systems - Unix Systems - Lecture Slides, Slides of Advanced Operating Systems

Partial preview of the text

Download Exploring Linux File Systems - Unix Systems - Lecture Slides and more Slides Advanced Operating Systems in PDF only on Docsity!

Chapter 4

Exploring Linux File systems

Objectives

  • Understand and navigate the Linux directory structure using relative and absolute pathnames
  • Describe the various types of Linux files
  • View filenames and file types
  • Use shell wildcards to specify multiple filenames

The Linux Directory Structure

  • Directory: Used to organize other files into a logical tree structure
  • Absolute pathname: Pathname from the root directory to a certain file or directory
  • Root: The top level directory
    • referred to using the / character

The Linux Directory Structure

(continued)

Figure 4-1: The Windows filesystem structure

Figure 4-2: The Linux filesystem structure

Changing Directories (continued)

  • Subdirectory: Directory residing within another directory
  • Tab-completion: Pressing the Tab key fills in remaining characters of a unique filename or directory name - BASH shell feature

Viewing Files and Directories: File Types

  • Text files: Store information in a readable text format
  • Binary data files: Store information associated with executable programs
  • Executable program files
  • Directory files

Filenames

  • Filename: Identifier given to a file
  • Filename extensions: Identifiers following a dot (.) at end of filename - Denote file type - Most files on Linux do not have file extensions

Filenames (continued)

Table 4-1: Common filename extensions

Listing Files

  • ls command: List the files in a directory
    • May pass an argument indicating the directory to be listed - โ€“ F switch: Argument to list file types - โ€“ l switch: Argument to list long file listings
  • Alias: Shortcut for a command
  • ll command: Alias for ls -l
  • File command: Displays file type of any file

Listing Files (continued)

  • Hidden files: Files not normally displayed to user - Filenames start with a dot (.) - Configuration files often hidden - ls โ€“ a command: Displays hidden files

Listing Files (continued)

Table 4-2 (continued): Common options to the ls command

Wildcard Metacharacters

  • Wildcard metacharacter: Used to simplify commands specifying multiple filenames - Can be used with most Linux filesystem commands

Displaying Content of Text Files

  • Concatenation: Joining text together
  • cat command: Displays (concatenates) contents of a text file to the screen - -n switch: Displays line number and contents
  • Log files: Contain records of past system events - New events appended to end
  • tac command: Displays files in reverse order
  • head command: View first few lines of a file

Displaying Content of Text Files (continued)

  • tail command: View last few lines of a file
    • Can also specify what line number to start at
  • more command: Displays text files page-by- page - Space key goes to next page - Enter key goes to next line
  • less command: Same as more command, but can also use cursor to scroll