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
Objectives (continued)
Changing Directories
Home directory: unique to each user
~ metacharacter used to refer to home directory
pwd (print working directory) command: displays
current directory in the directory tree
cd (change directory) command: change the current
directory in the directory tree
Argument specifies the destination directory
Relative pathname: pathname of file or directory
relative to current directory
Linux+ Guide to Linux Certification, 3e
Filenames
Filename: identifier given to a file
Up to 255 characters
Can use alphanumeric characters, dash (-),
underscore (_), and dot (.)
Filename extensions: identifiers following a dot (.) at
end of filename
Denote file type
Most files on Linux do not have filename extensions
10
11
Listing Files
ls command: List the files in a directory
May pass an argument indicating the directory to be
listed
F option: Argument to indicate file types
l option: Argument to list long file listings
12
13
14
15
16
Wildcard Metacharacters
Wildcard metacharacter: used to simplify commands
specifying multiple filenames
Can match the entire filename or portions of
filenames
Can be used with most Linux filesystem commands
17
18
19
20
21
22
23
24
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
Wildcard metacharacters have different definitions
that regexps
More regexps than wildcard metacharacters
Regular expressions are divided into common regexps
and extended regexps
Linux+ Guide to Linux Certification, 3e
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
Summary
The Linux filesystem is arranged hierarchically using a
series of directories to store files
Location of directories and files can be described using
absolute or relative pathnames
Linux filesystem can contain 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 to modify views
Linux+ Guide to Linux Certification, 3e
41
Summary (continued)
Wildcard metacharacters are special keyboard
characters
can simplify selection of several files when using
common Linux file commands
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
42
Summary (continued)
Regular expression metacharacters can be used to
specify certain patterns of text
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
43