Chapter 8 Flashcards

1
Q

Many Linux programs employ blank, which are tools for expressing patterns in text.

A

regular expressions

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Name the two most common forms of regular expression

A

basic and extended

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Characters enclosed in square brackets constitute blank, which match any one character within the brackets

A

Bracket Expressions

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Including a blank after the opening square bracket matches against any character except the ones specified.

A

caret ^

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

A blank is a variant on a bracket expression. Instead of listing every character that matches the start and end point are separated by a dash.

A

Range expressions

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

The dot (.) represents any blank except a newline.

A

single character

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

A blank consists of all the characters before the line is terminated with a new line.

A

text line (sometimes called a record)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

When not in brackets the blank represents the start of a line.

A

caret ^

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Blank represents the end of a line.

A

dollar sign $

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

An blank represents zero or more matches and is commonly used with a dot (.) to specify a substring.

A

asterisk *

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

If you want to match a special character such as (.), you must escape it by using what?

A

backslash /

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

With repetition operators, a blank matches one or more occurrences while a blank specifies zero or one.

A

plus +
question mark ?

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

The blank separates two possible matches.

A

vertical bar |

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Blank surround subexpressions and are often used to specify how to apply operators.

A

Parenthesis ()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

The blank command searches for files that contain a specified string and returns the name of the file and (if it’s a text file) the line containing the string

A

grep

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

You can also use blank to search a specified file for a specified string

A

grep

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

What option(s) with the grep command displays the number of lines that match, rather than the lines that contain matches to the regular expression

A

–count or -c

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q

What option(s) with the grep command takes pattern input from the specified file rather than from the command line. The fgrep command is a shortcut for this option.

A

–file=file or -f file

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
19
Q

What option(s) with the grep command performs a case-insensitive search, rather than the default case-sensitive search

A

–ignore-case -i

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
20
Q

What option(s) with the grep command searches in the specified directory and all subdirectories rather than simply the specified directory. The rgrep is a shortcut for this command.

A

– recursive -R or -r

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
21
Q

What option(s) with the grep command to use a regular expression. Alternatively, you can call egrep

A

–extended- regexp or -E

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
22
Q

Blank is when you must enclose regular expressions in quotes. Otherwise, the shell will incorrectly treat the regular expressions as shell commands.

A

shell quoting

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
23
Q

The blank utility uses a brute-force approach to finding files.

A

find

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
24
Q

What option(s) with the find command searches for files using their name. Doing so finds files that match the specified pattern. This pattern is a shelled wildcard pattern and not a regular expression

A

-name pattern

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
25
What option(s) with the find command to find files that have certain permissions. The mode may be expressed either symbolically or through octal.
-perm mode
26
What option(s) with the find command to search for files based on size.
-size n
27
What option(s) with the find command to search for files that belong to the specified group.
-group name
28
What option(s) with the find command to search for files whose GroupID is set to GID
-gid GID
29
What option(s) with the find command to search for files that are owned by a specified user
-user name
30
What option(s) with the find command to search for files by user UID number
-uid UID
31
What option(s) with the find command to limit the search of a directory and, perhaps, some limited number of subdirectories
-maxdepth levels
32
The blank command provides how many words or lines are in a text file.
wc
33
What option(s) with the wc command displays the file's byte count
--bytes or -c
34
What option(s) with the wc command displays the files character count
--chars or -m
35
What option(s) with the wc command displays the file's newline count
--lines or -l
36
What option(s) with the wc command displays the file's word count
--words or -w
37
What option(s) with the wc command displays the length of the longest line in the file
--max-line-length or -L
38
What command do you use when you only want part of a file record?
cut
39
What option(s) with the cut command selects only designated character position(s)?
--characters -c
40
What option(s) with the cut command uses the designated delimiter as the field delimiter instead of the default delimiter(tab)
--delimiter -d
41
What option(s) with the cut command selects only designated fields
--fields -f
42
What option(s) with the cut command prevents lines without a delimiter from being printed
--only-delimited -s
43
What command allows you to sort large amounts of data
sort
44
What option(s) with the sort command considers only blanks and alphanumeric characters, but ignores special characters
--dictionary-order or -d
45
What option(s) with the sort command ignores case
--ignore-case -f
46
What option(s) with the sort command sorts string by numeric value
--numeric-sort or -n
47
What option(s) with the sort command writes result to the specified file
--output-file or -o
48
What option(s) with the sort command sorts in descending order
--reverse or -r
49
Though blank is often used for displaying short text files on screen, it can also concatenate files together
cat
50
The cat command needs how many files as an argument to concatenate into a new file
two
51
If you want to use a program's output for future reference, you can blank it to a file
redirect
52
Redirection is achieved with the help of blank, which are short strings that appear after the command and its argument
Redirection operator
53
The output of redirection comes in what two types?
Standard output Standard error
54
What redirection operator creates a new file containing standard output. It rewrites if the specified file already exists.
>
55
What redirection operator appends standard output to the existing file. If the specified file does not exist, it creates it.
>>
56
What redirection operator creates a new file containing error messages. If the specified file already exists, it is overwritten
2>
57
What redirection operator appends standard error to the existing file. If the specified file does not exist, it is created.
2>>
58
What redirection operator creates a new file containing both standard output and standard error. If the specified file exists, it is overwritten.
&>
59
What redirection operator sends the contents of the specified file to be used as standard input
<
60
What redirection operator accepts the text on the following lines as standard input
<<
61
What redirection operator causes the specified file to be used for both standard input and standard output
<>
62
In a blank, standard output from one program is redirected as standard input to a second program.
pipe
63
The blank command's purpose in a pipeline is to build a command from its standard input
xargs
64
GIve the xargs basic syntax
xargs [OPTIONS] [COMMAND [INITIAL-ARGUMENTS]]
65
Text placed within two blank is treated as a separate command whose results are substituted on the command line
back ticks `
66
Using backticks in this way is called blank, because you are providing a substitution for one of the command's arguments
command substitution
67
Name the other and more favorable way of denoting command substitution
$()
68
The tar's program name stands for blank
tape archive
69
Regardless of its name, you can use blank to backup (or archive) data to your hard disk or other media, not just to tapes
tar
70
Because an archive file can be quite large, it is often compressed via the tar program into a blank
tarball
71
Whenever you run tar, you use blank option and usually at least one blank
one qualifier
72
Name the tar option(s) that creates an archive
--create or -c
73
Name the tar option(s) that appends tar files to an archive
--concatenate or -A
74
Name the tar option(s) that appends non-tar files to an archive
--append or -r
75
Name the tar option(s) that appends files that are newer than those in an archive
--update or -u
76
Name the tar option(s) that compares an archive to files on the disk
--diff or --compare or -d
77
Name the tar option(s) that lists an archive's contents
--list or -t
78
Name the tar option(s) that extracts files from an archive
--extract or --get or -x
79
Name the tar qualifier(s) that changes to directory dir before performing operations
--directory dir or -C
80
Name the tar qualifier(s) that uses the file called file on the computer called host as the archive file
--file[host:]file or -f
81
Name the tar qualifier(s) that performs an incremental backup or restore, using file as a list of previously archived files
--listed-incremental file or -g
82
Name the tar qualifier(s) that backs up only one filesystem(partition)
--one-file-system
83
Name the tar qualifier(s) that creates or extracts a multitape archive
--multi-volume or -M
84
Name the tar qualifier(s) that changes tapes after N kilobytes
--tape-length N or -L
85
Name the tar qualifier(s) that preserves all protection information
--same-permissions or -p
86
Name the tar qualifier(s) that retains the leading / on filenames
--absolute-names or -P
87
Name the tar qualifier(s) that lists all files read or extracted; when used with --list displays the file sizes, ownership, and time stamps
--verbose or -v
88
Name the tar qualifier(s) that verifies the archive after writing it
--verify or -W
89
Name the tar qualifier(s) that excludes file from the archive
--exclude file
90
Name the tar qualifier(s) that excludes files listed in file from the archive
--exclude-from file or -X
91
Name the tar qualifier(s) that processes an archive through gzip
--gzip or --ungzip or -z
92
Name the tar qualifier(s) that processes an archive through bzip2
--bzip2 or -j or( -I or -y older)
93
In Linux, the blank, blank, and blank all compress individual files.
gzip, bzip2, xz
94
Of the three compression commands, which provides the least compression?
gzip
95
Of the three compression commands, which provides the most compression?
xz
96
What is the decompression program for gzip?
gunzip
97
What is the decompression program for bzip2?
bunzip2
98
What is the decompression program for xz?
unxz
99
What is the filename extension for gzip?
.gz
100
What is the filename extension for bzip2?
.bz2
101
What is the filename extension for xz?
.xz
102
What is the tarball filename extension for gzip?
.tgz
103
What is the tarball filename extension for bzip2?
.tbz or .tbz2 or .tb2
104
What is the tarball filename extension for xz?
.txz
105
The gzip, bzip2 and xz compression programs all apply blank, meaning the data recovered by uncompressing the file is identical to what went into it
lossless compression
106
Some graphics, audio, and audiovisual file formats apply blank, in which some data is discarded
lossy compression
107
Outside of the Unix and Linux world, the blank file format is a common one that fills a role similar to a compressed tarball.
zip
108
What option used with the zip command sets the amounts of compression from low to high
-0 through -9
109
What option used with the zip command deletes the specified files from the archive file?
--delete or -d
110
What option used with the zip command encrypts the archive with a password
--encrypt or -e
111
What option used with the zip command updates the file in an archive if they've changed since the original archive's creation
--freshen or -f
112
What option used with the zip command performs on repairs on a damaged archive file.
--fix or -F (minimal) --fixfix or -FF
113
What option used with the zip command updates the file in an archive if they've changed since the original archive's creation
--filesync or -FS
114
What option used with the zip command appends files to an existing archive
--grow or -g
115
What option used with the zip command displays basic help information
--help or -h or -?
116
What option used with the zip command moves the files into the zip archive - that is, the original files are deleted
--move or -m
117
What option used with the zip command includes files subdirectories inside the directories you specify
--recurse-paths or -r
118
What option used with the zip command creates a potentially multifile archive with each file no larger than size bytes
--split-size size or -s size
119
What option used with the zip command excludes the specified files
--exclude files or -x files
120
What option used with the zip command includes symbolc links
--symlinks or -y
121
What option used with the unzip command freshens files from the archive
-f
122
What option used with the unzip command lists files in the archive but does not extract them
-l
123
What option used with the unzip command extracts files to a pipeline
-p
124
What option used with the unzip command test the integrity of files in the archive
-t
125
What option used with the unzip command updates the files, but also extracts files that don't exist on the filesystem
-u
126
What option used with the unzip command lists files in the archive in a more verbose format than -l does
-v
127
What option used with the unzip command converts filenames to lowercase if they originated on an uppercase-only OS, such as DOS
-L
128
What option used with the unzip command never overwrites existing files
-n
129
What option used with the unzip command overwrites existing files without prompting
-o
130
Which of the following commands will print lines from world.txt that contains matches to changes and changed A. grep changes[ds] world.txt B. tar change[d-s] world.txt C. find "change'd|s" world.txt D. cat world.txt changes changed E. find change[^ds] world.txt
A
131
Which of the redirection operators appends a program's standard output to an existing file without overwriting that file's original contents.
>>
132
You've received a tar archive, but you want to check the name of the files it contains before you extract them. Which of the following commands would you use to do this? A. tar uvf data79.tar B. tar cvf data79.tar C. tar xvf data79.tar D. tar tvf data79.tar E. tar Avf data79.tar
D
133
True or False: the regular expression Linu[^x].*lds matches the string Linus Torvalds
True
134
True or False: The find command allows you to locate files based on size
True
135
True or False: To compress files archived with zip, you must use an external compression program such as gzip, xz, or bzip2 in a pipeline with zip
False
136
The blank command can extract specified data fields from a file's records
cut
137
Complete the following command to redirect both standard output and standard error from the bigprog program to the file out.txt. $bigprog blank out.txt
&>
138
THe gzip, bzip2, and xz programs all perform blank compression.
Lossless