Networking Chapter 4 Homework Unix Linux Users And system Administrator’s a Guide Unix Using Linux Fourth Edition teaching tip 47 some Disadvantages Shell

subject Type Homework Help
subject Pages 9
subject Words 2027
subject Authors Michael Palmer

Unlock document.

This document is partially blurred.
Unlock all pages and 1 million more documents.
Get Access
page-pf1
A Guide to Unix Using Linux, Fourth Edition 4-1
Chapter 4
UNIX/Linux File Processing
At a Glance
Instructor’s Manual Table of Contents
Overview
Objectives
Teaching Tips
Quick Quizzes
page-pf2
A Guide to Unix Using Linux, Fourth Edition 4-2
Lecture Notes
Overview
Chapter 4 provides an introduction to UNIX/Linux file processing. Students learn to use
basic file manipulation commands to create, delete, copy, and move files and
Chapter Objectives
Explain UNIX and Linux file processing
Use basic file manipulation commands to create, delete, copy, and move files and
directories
Teaching Tips
UNIX and Linux File Processing
1. Explain that in UNIX/Linux, files are treated as nothing more than character sequences.
Briefly describe the advantages of this approach:
a. You can directly access each character.
Reviewing UNIX/Linux File Types
1. Briefly describe the role of each of the file types available in UNIX/Linux systems:
a. Text files
b. Binary files
page-pf3
3. Remind students how to distinguish each of the types listed above in the file
permissions string displayed by ls (i.e., type indicated by “-“, “d”, “c”, or “b” in the first
position of the string).
Understanding File Structures
1. Explain that there are different ways to structure files. Describe the difference between
2. Three simple kinds of text files are: unstructured ASCII characters, records, and trees
Processing Files
1. Describe the role of the standard devices/files (stdin, stdout, and stderr) in UNIX/Linux
Using Input and Error Redirection
1. Use several examples to show students how to use >, < and, 2> for input, output, and
error redirection.
2. Remind students that >> and << can also be used for redirection.
page-pf4
A Guide to Unix Using Linux, Fourth Edition 4-4
Quick Quiz 1
1. In a UNIX/Linux file, a(n) ____________________ is a line of data, corresponding to a
row.
2. In a file with a tree structure, each record contains a(n) ____________________ field,
such as a record number, in a specific position in the record.
3. When UNIX/Linux detect errors in processing system tasks and user programs, they
direct the errors to ____________________, which, by default, is the screen.
4. You can use the ____________________ operator to redirect commands or program
error messages from the screen to a file.
Manipulating Files
Creating Files
2. Stress that the primary purpose of touch is to change a file’s time stamp and date stamp.
Deleting Files
2. You may also use an example to show how to use wildcard characters to remove
multiple files at once.
Remind students that an inode is a system for storing key information about files.
page-pf5
A Guide to Unix Using Linux, Fourth Edition 4-5
Removing Directories
1. Explain how to use rm, rm r, and rmdir to remove empty and non-empty directories.
Copying Files
2. Use several examples to show students how to use cp to copy files and directories.
Moving Files
1. Describe the syntax of the mv command. Note that as insurance, a file is copied before it
is moved.
Finding Files
1. Describe the syntax of the find command.
Combining Files
1. Use an example to show students how you can use cat to combine files.
Combining Files with the paste Command
1. Describe the syntax of the paste command. Emphasize that this command can be used
2. Use an example to illustrate the use of this command (see Figure 4-3).
page-pf6
A Guide to Unix Using Linux, Fourth Edition 4-6
Extracting Fields Using the cut Command
1. Describe the syntax of the cut command.
Sorting Files
1. Describe the syntax of the sort command.
2. Use the example shown in Figure 4-5 to illustrate how to sort files using this command.
Quick Quiz 2
1. You can use the ____________________ command to create empty files.
2. The rm command with the ____________________ option removes a directory and
everything it contains.
3. The ____________________ command searches for files that have a specified name.
4. The ____________________ command combines files side by side.
Creating Script Files
1. Explain the importance of shell scripts in automating tasks for UNIX/Linux users and
system administrators.
page-pf7
A Guide to Unix Using Linux, Fourth Edition 4-7
2. Briefly describe the process involved in creating and using a shell script:
a. Create script using a text editor (e.g., vi, Emacs).
3. Figure 4-6 shows a sample script file.
Using the join Command on Two Files
1. Briefly describe the syntax of the join command.
2. Use an example to show how to use the join command on two files.
A Brief Introduction to the Awk Program
1. Provide a brief introduction of the Awk program, including its syntax.
Note that the program gawk is used in Fedora, Red Hat Enterprise Linux, SUSE,
2. Note that some of the tasks you can do with awk include:
a. Manipulate fields and records in a data file.
page-pf8
A Guide to Unix Using Linux, Fourth Edition 4-8
3. Provide one or more examples to show students how powerful this command is.
Quick Quiz 3
1. You can make a shell script file executable by using the ____________________
command with the x argument.
2. You can use the ____________________ command to associate lines in two files on the
basis of a common field in both files.
3. When using join, the common field provides a(n) ____________________ for
accessing and joining the information to create a report or to create another file with the
joined information.
4. The name Awk is formed from the initials of its inventors, (Alfred) Aho, (Peter)
Weinberger, and (Brian) ____________________.
Class Discussion Topics
2. Students may have experience locating files using a GUI (e.g., Windows Search
feature). Ask them to compare the command-line find with the GUI search tool of their
choice.
Additional Projects
1. Ask students to try the redirection exercises of Hands-On Project 4-1 and Hands-On
page-pf9
2. Ask students to repeat the exercise of Hands-On Project 4-3 using locate instead of find.
Additional Resources
1. Standard Input and Output Redirection:
3. Unix Shell Scripts (for the C Shell):
4. Awk Tutorial:
Key Terms
fixed-length record A record structure in a file in which each record has a specified
length, as does each field in a record.
called an ordinary file.
relational database A database that contains files that UNIX/Linux treat as tables,
records that are treated as rows, and fields that are treated as columns and that can be
joined to create new records. For example, using the join command, you can extract
information from two files in a relational database that share a common field.
page-pfa
to read input (part of the IEEE Std 1003.1 specification).
stdout An acronym used by programmers for standard output and used in
programming to write output (part of the IEEE Std 1003.1 specification).
variable-length record A record structure in a data file in which the records can
have variable lengths and are typically separated by a delimiter, such as a colon.
Technical Notes for Hands-On Projects
For all projects in the chapter, students should log in using their own accounts, rather than
logging in as root. All the projects require a console or terminal window in which the different
commands will be entered. Additionally, the following projects require the vi editor: 4-1, 4-12,

Trusted by Thousands of
Students

Here are what students say about us.

Copyright ©2022 All rights reserved. | CoursePaper is not sponsored or endorsed by any college or university.