Networking Chapter 4 1 option of the mv command that overwrites a destination file with the same name,

subject Type Homework Help
subject Pages 7
subject Words 1442
subject Authors Michael Palmer

Unlock document.

This document is partially blurred.
Unlock all pages and 1 million more documents.
Get Access
page-pf1
CHAPTER 4: UNIX/LINUX FILE PROCESSING
TRUE/FALSE
1. UNIX/Linux store data, such as letters, product records, or vendor reports, in flat ASCII files.
2. The command rmdir can be used to delete a directory that is not empty.
3. Moving and renaming a file are essentially the same operation.
4. When you are moving files, using the -o option with the mv command can be a good idea so that you
don’t unexpectedly overwrite a destination file with the same name.
5. When you use cat to combine two files into a third file, the first line of the output contains the first line
of the first file followed by the first line of the second file.
6. When you use the paste command, by default, the pasted results appear in columns separated by
commas.
7. You can complete a project using awk that you cannot complete using a combination of paste, cut,
sort, and join.
MULTIPLE CHOICE
1. In UNIX/Linux, text files and binary files are considered to be ____ files.
a.
executable
c.
regular
b.
document
d.
dynamic
2. Character special files are used by input/output devices for communicating one character at a time,
providing what is called ____ data.
a.
raw
c.
ASCII
b.
binary
d.
block
3. System administrators and programmers refer to standard input as ____.
page-pf2
a.
sin
c.
stdin
b.
stin
d.
standardin
4. System administrators and programmers refer to standard output as ____.
a.
sout
c.
stdout
b.
stout
d.
standardout
5. To redirect the list of the files in a directory to a file called homedir.list, you enter ____.
a.
ls < homedir.list
c.
homedir.list < ls
b.
ls > homedir.list
d.
homedir.list > ls
6. You can use the ____ operator to redirect commands or program error messages from the screen to a
file.
a.
1>
c.
3>
b.
2>
d.
4>
7. The command > accountsfile ____.
a.
deletes de file accountsfile
b.
is not valid in UNIX/Linux systems
c.
displays the contents of the file accountsfile on the screen
d.
creates an empty file called accountsfile
8. You can use the ____ command to create empty files.
a.
touch
c.
make
b.
create
d.
null
9. When you no longer need a file, you can delete it using the ____ command.
a.
rm
c.
dl
b.
remove
d.
delete
10. When you no longer need a directory, you can use command ____ to remove it.
a.
xtree
c.
dldir
b.
rmdir
d.
deltree
11. The cp ____ option creates a symbolic link or name at the destination rather than a physical file.
a.
-s
c.
-l
b.
-y
d.
-n
12. To move a file, you use the ____ command along with the source file name and destination name.
page-pf3
a.
rm
c.
mv
b.
rename
d.
move
13. The ____ option of the find command displays files that have been changed within the last n minutes.
a.
-min n
c.
-nmin n
b.
-cmin n
d.
-mmin n
14. The ____ option of the find command displays files that have been changed within the last n days.
a.
-cdays n
c.
-mdays n
b.
-ctime n
d.
-mtime n
15. When you use find, it is useful to note that some UNIX versions require the ____ option after the file
name to display the names of files.
a.
-display
c.
-show
b.
-print
d.
-names
16. The paste command normally sends its output to ____.
a.
stdout
c.
stderr
b.
null
d.
the file indicated as an argument
17. The ____ option of the paste command is used to specify a different separator as a delimiter.
a.
-t
c.
-d
b.
-o
d.
-s
18. If you execute ____, the contents of file1 are sorted and the results are stored in file2.
a.
sort file1 -o file2
c.
sort file1 > file2
b.
sort file1 -d file2
d.
sort file1 file2
19. A sorting ____ is a field position within each line.
a.
index
c.
column
b.
key
d.
position
20. To run the myscript shell script located in the current directory, you should enter: ____.
a.
start myscript
c.
run myscript
b.
/.myscript
d.
./myscript
21. The join command is used to associate information in two different files on the basis of a common
field or ____ in those files.
a.
index
c.
column
page-pf4
b.
link
d.
key
22. The ____ command is used to look for patterns in files.
a.
awk
c.
pattern
b.
find
d.
search
COMPLETION
1. ____________________ special files are related to devices, such as disks, and send information using
blocks of data.
2. When UNIX/Linux detect errors in processing system tasks and user programs, they direct the errors
to ____________________, which, by default, is the screen.
3. Although the touch command cannot alter a file’s ____________________ changed date and time, it
can alter the file’s access and modification dates and times.
4. The ____________________ option of the paste command causes files to be pasted one after the other
instead of in parallel.
5. You can use the ____________________ command to remove specific columns or fields from a file.
6. You can use the ____________________ command to sort a file’s contents alphabetically or
numerically.
page-pf5
7. You can use the ____________________ command to associate lines in two files on the basis of a
common field in both files.
MATCHING
Match each item with a statement below.
a.
-name
f.
-i
b.
-r
g.
-u
c.
-c
h.
paste
d.
>
i.
-t
e.
-d
1. this option prevents the touch command from creating a file, if it does not already exist
2. when deleting a directory with rm, this option is used to recursively delete its files and subdirectories
3. option of the cp command that provides a warning before an existing file with the same name is
overwritten
4. option of the mv command that overwrites a destination file with the same name, if the source file is
newer than the one in the destination
5. is an option of the find command
6. can be used with cat to combine the contents of two files
7. combines files side by side
8. option of the cut command used to indicate that a specific character separates the fields
9. option of the sort command used to indicate that a specific character separates the fields
SHORT ANSWER
1. What is a variable-length record?
page-pf6
2. What is a fixed-length record?
3. Assuming project1, project2 and project3 are files, what is the purpose of entering the following
command?
cp project1 project2 project3 duplicates
4. What is the purpose of entering the following command?
cp designs/* duplicates
5. What is the find command used for?
6. What is the purpose of entering the following command?
cat janes_research marks_research > total_research
7. Consider a simple file, called vegetables, containing the following four lines:
Carrots
Spinach
Lettuce
Beans
page-pf7
We also have a bread file that contains the following four lines:
Whole wheat
White bread
Sourdough
Pumpernickel
What will be the result of executing the following command?
paste -d’,’ vegetables bread > food
8. What is a shell script?
9. What is Awk?
10. Describe some tasks that the awk command can perform.

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.