Linux+ Guide to Linux Certification, Second Edition Chapter 4 Exploring Linux Filesystems.

Slides:



Advertisements
Similar presentations
RH030 Linux Computing Essentials
Advertisements

RH030 Linux Computing Essentials
A Guide to Unix Using Linux Fourth Edition
NETW-240 Shells Last Update Copyright Kenneth M. Chipps Ph.D. 1.
The Unix File System. What are the three parts of every file on a Unix filesystem? And where is each stored? Filename - stored in directories Inode -
Lab6 CPCS361 I.Mona Alshehri. Working with Files and Directories Creating files Create a file with the cat command type the command cat > name_of_file.
Linux+ Guide to Linux Certification, Second Edition
Linux+ Guide to Linux Certification, Second Edition
Linux+ Guide to Linux Certification, Second Edition
Guide To UNIX Using Linux Third Edition
Guide to Linux Installation and Administration, 2e1 Chapter 6 Using the Shell and Text Files.
Using Linux Text Editors. Use Non-Graphical Linux Text Editors Graphical Text Editor.
COMP1070/2002/lec4/H.Melikian COMP1070 Lecture #5  Files and directories in UNIX  Various types of files  File attributes  Notion of pathname  Commands.
Linux+ Guide to Linux Certification Chapter Three Linux Installation and Usage.
Advanced File Processing
Filesystem Hierarchy Standard (FHS) –Standard of outlining the location of set files and directories on a Linux system –Gives Linux software developers.
Unix Primer. Unix Shell The shell is a command programming language that provides an interface to the UNIX operating system. The shell is a “regular”
Chapter 9 Part II Linux Command Line Access to Linux Authenticated login using a Linux account is required to access a Linux system. The Linux prompt will.
Linux environment ● Graphical interface – X-window + window manager ● Text interface – terminal + shell.
Chapter 3 Mastering Editors
Week 7 Working with the BASH Shell. Objectives  Redirect the input and output of a command  Identify and manipulate common shell environment variables.
Agenda User Profile File (.profile) –Keyword Shell Variables Linux (Unix) filters –Purpose –Commands: grep, sort, awk cut, tr, wc, spell.
Chapter Four UNIX File Processing. 2 Lesson A Extracting Information from Files.
Guide To UNIX Using Linux Fourth Edition
CENT 305 Information Systems Security Linux Introduction.
The UNIX Shell. The Shell Program that constantly runs at terminal after a user has logged in. Prompts the user and waits for user input. Interprets command.
Linux+ Guide to Linux Certification, Second Edition
Chapter Three The UNIX Editors. 2 Lesson A The vi Editor.
Linux+ Guide to Linux Certification Chapter Four Exploring Linux Filesystems.
Linux+ Guide to Linux Certification, Third Edition
Guide to Linux Installation and Administration, 2e1 Chapter 7 The Role of the System Administrator.
Week 3 Exploring Linux Filesystems. Objectives  Understand and navigate the Linux directory structure using relative and absolute pathnames  Describe.
Advanced File Processing. 2 Objectives Use the pipe operator to redirect the output of one command to another command Use the grep command to search for.
Linux+ Guide to Linux Certification, Third Edition
Linux Operations and Administration
Chapter Five Advanced File Processing Guide To UNIX Using Linux Fourth Edition Chapter 5 Unix (34 slides)1 CTEC 110.
Linux+ Guide to Linux Certification Chapter Eight Working with the BASH Shell.
Agenda Regular Expressions (Appendix A in Text) –Definition / Purpose –Commands that Use Regular Expressions –Using Regular Expressions –Using the Replacement.
1 Operating Systems and Using Linux Topics What is an Operating System? Linux Overview Frequently Used Linux Commands Some content in this lecture added.
Using Commands Unix / Linux Preparation Course May 6, 2012 Serrekunda, The Gambia.
Chapter Five Advanced File Processing. 2 Lesson A Selecting, Manipulating, and Formatting Information.
UNIX An Introduction. Brief History UNIX UNIX Created at Bell Labs, 1969 Created at Bell Labs, 1969 BSD during mid 70s BSD during mid 70s AT&T began offering.
Agenda Basic Unix Commands (Chapters 2 & 3) Miscellaneous Commands: whereis, which, whoami, finger, passwd, cal, date Working with Files: cat, more, less.
Introduction to Unix (CA263) File Editing By Tariq Ibn Aziz.
Lesson 4-Mastering the Visual Editor. Overview Introducing the visual editor. Working in an existing file with vi. Understanding the visual editor. Navigating.
Chapter Three The UNIX Editors.
Linux+ Guide to Linux Certification, Third Edition
Linux+ Guide to Linux Certification, Third Edition
Agenda Basic Unix Commands (Chapters 2 & 3) Miscellaneous Commands: which, passwd, date, ps / kill Working with Files: file, touch, cat, more, less, grep,
Lesson 3-Touring Utilities and System Features. Overview Employing fundamental utilities. Linux terminal sessions. Managing input and output. Using special.
Using the “CLI” Unix / Linux Preparation Course June 9, 2013 Lusaka, Zambia.
Linux Commands C151 Multi-User Operating Systems.
PTA Linux Series Copyright Professional Training Academy, CSIS, University of Limerick, 2006 © Workshop III - Part A Shell Commands Professional Training.
Linux+ Guide to Linux Certification, Second Edition
A Brief Overview of Unix Brandon Bohrer. Topics What is Unix? – Quick introduction Documentation – Where to get it, how to use it Text Editors – Know.
Operating Systems and Using Linux Courtesy of John Y. Park 1.
Linux Tutorial Lesson Two *Getting Help in Linux *Data movement and manipulation *Relative and Absolute path *Processes Note: see chapter 1,2,3 from Linux.
Learning Unix/Linux Based on slides from: Eric Bishop.
Linux Administration Working with the BASH Shell.
Chapter 3: Mastering Editors Chapter 3 Mastering Editors (Emacs)
Lesson 5-Exploring Utilities
SUSE Linux Enterprise Desktop Administration
C151 Multi-User Operating Systems
Guide To UNIX Using Linux Third Edition
Guide To UNIX Using Linux Third Edition
Chapter Four UNIX File Processing.
Introduction Paul Flynn
CSE 303 Concepts and Tools for Software Development
Module 6 Working with Files and Directories
Linux Operations and Administration
Presentation transcript:

Linux+ Guide to Linux Certification, Second Edition Chapter 4 Exploring Linux Filesystems

Linux+ Guide to Linux Certification, 2e2 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

Linux+ Guide to Linux Certification, 2e3 Objectives (continued) Display the contents of text files and binary files Search text files for regular expressions using grep Identify common text editors used today Use the vi editor to manipulate text files

Linux+ Guide to Linux Certification, 2e4 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

Linux+ Guide to Linux Certification, 2e5 The Linux Directory Structure (continued) Figure 4-1: The Windows filesystem structure Figure 4-2: The Linux filesystem structure

Linux+ Guide to Linux Certification, 2e6 Changing Directories Home directory: Unique to each user pwd (print working directory) command: Displays current directory in the directory tree cd (change directory) command: Change the current directory in the directory tree ~ metacharacter: Refers to home directory Relative pathname: Pathname of file or directory relative to current directory

Linux+ Guide to Linux Certification, 2e7 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

Linux+ Guide to Linux Certification, 2e8 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

Linux+ Guide to Linux Certification, 2e9 Viewing Files and Directories: File Types (continued) Linked files: Associated with another file Special device files: Represent system devices Named pipes: Identify channel that passes information between processes Socket files: Allow a process on another computer to write to a local file

Linux+ Guide to Linux Certification, 2e10 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

Linux+ Guide to Linux Certification, 2e11 Filenames (continued) Table 4-1: Common filename extensions

Linux+ Guide to Linux Certification, 2e12 Filenames (continued) Table 4-1 (continued): Common filename extensions

Linux+ Guide to Linux Certification, 2e13 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

Linux+ Guide to Linux Certification, 2e14 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

Linux+ Guide to Linux Certification, 2e15 Listing Files (continued) Table 4-2: Common options to the ls command

Linux+ Guide to Linux Certification, 2e16 Listing Files (continued) Table 4-2 (continued): Common options to the ls command

Linux+ Guide to Linux Certification, 2e17 Wildcard Metacharacters Wildcard metacharacter: Used to simplify commands specifying multiple filenames –Can be used with most Linux filesystem commands

Linux+ Guide to Linux Certification, 2e18 Wildcard Metacharacters (continued) Table 4-3: Wildcard metacharacters

Linux+ Guide to Linux Certification, 2e19 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

Linux+ Guide to Linux Certification, 2e20 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

Linux+ Guide to Linux Certification, 2e21 Displaying Content of Text Files (continued) more and less can be used with output of other commands –If output is too large to fit on terminal screen, use “|” metacharacter –e.g., ls -l | more

Linux+ Guide to Linux Certification, 2e22 Displaying the Contents of Binary Files Typically use program that created the file strings command: Searches for and displays text characters in a binary file –Might indicate purpose of binary file od command: Displays contents of file in octal format (numeric base 8 format)

Linux+ Guide to Linux Certification, 2e23 Searching for Text Within Files Text tools: Search for and manipulate text Regular expressions (regexp): Text wildcards that assist search for specific text –Match patterns of text –Used by many text tools and programming languages Including grep, emacs, C++, PERL, and many more

Linux+ Guide to Linux Certification, 2e24 Regular Expressions Different from wildcard metacharacters –Wildcard metacharacters interpreted by shell; regexps interpreted by text tools –Wildcard metacharacters match characters in filenames; regexps match characters within text files –More regexps than wildcard metacharacters Common and extended regexps

Linux+ Guide to Linux Certification, 2e25 Regular Expressions (continued) Table 4-4: Regular expressions

Linux+ Guide to Linux Certification, 2e26 Regular Expressions (continued) Table 4-4 (continued): Regular expressions

Linux+ Guide to Linux Certification, 2e27 The grep Command grep (global regular expression print) command: Displays lines in a text file matching a given regexp egrep command: Displays lines of text that match extended regexps fgrep command: Does not interpret any regular expressions –Returns results much faster than egrep grep requires two arguments –Text to search for and files to search

Linux+ Guide to Linux Certification, 2e28 Editing Text Files: The vi Editor One of the oldest and most popular text editors for UNIX OSs Vim: Linux equivalent of vi –Standard on most Linux distributions Advantage is portability, not usability –Used on Unix and Linux Bi-modal editor (two possible modes): –Command mode: Performs text editing tasks not related to inserting text –Insert mode: Inserts text, but nothing else User environment is customizable

Linux+ Guide to Linux Certification, 2e29 Editing Text Files: The vi Editor (continued) Table 4-5: Common keyboard keys used to change to and from insert mode

Linux+ Guide to Linux Certification, 2e30 Editing Text Files: The vi Editor (continued) Table 4-6: Key combinations commonly used in command mode

Linux+ Guide to Linux Certification, 2e31 Editing Text Files: The vi Editor (continued) Table 4-6 (continued): Key combinations commonly used in command mode

Linux+ Guide to Linux Certification, 2e32 Editing Text Files: The vi Editor (continued) Table 4-6 (continued): Key combinations commonly used in command mode

Linux+ Guide to Linux Certification, 2e33 Editing Text Files: The vi Editor (continued) Table 4-7: Key combinations commonly used at the command mode : prompt

Linux+ Guide to Linux Certification, 2e34 Other Common Text Editors Mcedit editor (Midnight Commander Editor): Easy- to-use text editor –Supports regexp –Supports use of mouse for highlighting text Emacs (Editor MACroS) editor: Comparable functionality to vi –Ctrl key combinations to perform special functions –Supports LISP (LISt Processing) artificial intelligence programming language

Linux+ Guide to Linux Certification, 2e35 Other Common Text Editors (continued) Table 4-8: Keyboard functions commonly used in the GNU emacs editor

Linux+ Guide to Linux Certification, 2e36 Other Common Text Editors (continued) Emacs editor is not easy to use –Must memorize key combinations Xemacs editor: Version of Emacs for KDE or GNOME GUI environments –Easier to use than emacs –Not available with every distribution

Linux+ Guide to Linux Certification, 2e37 Other Common Text Editors (continued) Figure 4-3: The xemacs text editor

Linux+ Guide to Linux Certification, 2e38 Other Common Text Editors (continued) Graphical text editors available with most Linux distributions: –nedit editor –gedit editor: Distributed with GNOME environment –kedit editor: Distributed with KDE environment gedit and kedit offer more functionality than nedit

Linux+ Guide to Linux Certification, 2e39 Other Common Text Editors (continued) Figure 4-4: The nedit text editor

Linux+ Guide to Linux Certification, 2e40 Other Common Text Editors (continued) Figure 4-5: The gedit text editor

Linux+ Guide to Linux Certification, 2e41 Other Common Text Editors (continued) Figure 4-6: The kedit text editor

Linux+ Guide to Linux Certification, 2e42 Summary The Linux filesystem is arranged hierarchically using a series of directories to store files Location of these directories and files can be described using absolute or relative pathnames Accommodates many types of files: text files, binary data, executable programs, directories, linked files, and special device files The ls command is used to view filenames –Wide range of options Wildcard metacharacters can simplify selection of several files when using common Linux file commands

Linux+ Guide to Linux Certification, 2e43 Summary (continued) Text files are the most common file type whose contents can be viewed by several utilities, such as head, tail, cat, tac, more, and less Regular expression metacharacters can be used to specify certain patterns of text when used with certain programming languages and text tool utilities such as grep vi (vim) is a powerful, bimodal text editor that is standard on most UNIX and Linux systems