Mindtap Ch. 3
file globbing
The process of wildcard expansion-for instance, matching the existing file glossary.txt when the string glos*.txt is typed. Also called globbing.
cd
change directory
The vi editor is called a bimodal editor because it functions in one of two modes: ________ and_________.
command mode insert mode
To view lines that contain the text "lodge" or "Lake," you need to use an extended regular expression and the egrep command, as follows:
egrep "(lodge|Lake)" project4
To count the number of lines in /etc/yum.conf that either start with 1 or end with 01, what command is used?
egrep -c '1|01$' /etc/yum.conf
What will typing q! at the : prompt in command mode do when using the vi editor?
quit without saving any changes
Using the grep command, you want to count the number of lines in which the searched text appears. Which parameter should you use?
-c
to combine more than one sed command you use the _________
-e switch
Which parameter of the grep command displays the line number of the line that contains the searched text?
-n
filenames can include up to _______ characters
255, alpha numeric _ - .
grep command requires ____ arguments at minimum
2; first specifies which text to search for, second specifies the files to search \\\ ex. grep "Algonquin Park" project4
you can quit the vi editor by typing the __ character and entering __, which then returns the user to the shell prompt:
: q!
When using the vi text editor, which of the following keys, when in command mode, will change to insert mode and place the cursor at the end of the current line?
A
file command
A Linux command that displays the file type of a specified filename. filename The user-friendly identifier given to a file.
head command
A Linux command that displays the first set of lines of a text file; by default, the head command displays the first 10 lines.
grep command
A Linux command that searches files for patterns of characters using regular expression metacharacters. The command name is short for "global regular expression print."
cat command
A Linux command used to display (or concatenate) the entire contents of a text file to the screen.
more command
A Linux command used to display a text file page-by-page and line-by-line on the terminal screen.
less command
A Linux command used to display a text file page-by-page on the terminal screen; users can then use the cursor keys to navigate the file.
tail command
A Linux command used to display lines of text at the end of a file; by default, the tail command displays the last 10 lines of the file.
od command
A Linux command used to display the contents of a file in octal format.(base 8 number system)
strings command
A Linux command used to search for and display text characters in a binary file.
gedit editor
A common text editor used within GUI environments
binary data file
A file that contains machine language (binary 1s and 0s) and stores information (such as common functions and graphics) used by binary compiled programs.
special device file
A file used to identify hardware devices such as hard disks and serial ports.
filename extension
A filename extension is a suffix (separated from the base filename by a dot or space) to the name of a computer file applied to indicate the encoding (file format) of its contents or usage.
socket file
A named pipe connecting processes on two different computers; it can also be represented by a file on the filesystem.
Emacs (Editor MACroS) editor
A popular and widespread text editor more conducive to word processing than vi. It was originally developed by Richard Stallman.
vi editor
A powerful command-line text editor available on most UNIX and Linux systems.
named pipe file
A temporary connection that sends information from one command or process in memory to another; it can also be represented by a file on the filesystem.
nano editor
A user-friendly terminal text editor that uses Ctrl key combinations to perform basic functions.
fgrep command
A variant of the grep command that does not allow the use of regular expressions / returns results faster
egrep command
A variant of the grep command, used to search files for patterns using extended regular expressions.
regular expression (regex)
A way to validate a string using formal language by looking for string patterns
ll command
An alias for the ls -l command; it gives a long file listing.
regular expression metacharacters are divided into two categories:
Common(basic)- available to most text tools Extended - less common and available in only certain text tools
When using the vi text editor, which of the following keys, when in command mode, will move to the last line in the document? a. G b. L c. P d. W
G
After typing the ls -a command, you notice a file whose filename begins with a dot ( . ). What does this mean?
It is a hidden file.
~
Refer to another users directory, ~mary
grep -v
Selects lines that do not much any of the specified patterns
sed
Tool used for performing automatic non-interactive editing of files. You can use most of the regular expressions with this tool to locate the required text
A user typed in the command pwd and saw the output: /home/jim/sales/pending. How could that user navigate to the /home/jim directory?
cd ../..
grep -i
ignore case
Using wildcard metacharacters, how can you indicate a character that is not an a or b or c or d?
[!a-d]
linked files
are files that have an association with one another and they represent the same data or they point to another file.
wildcard metacharacters
are used to simplify commands specifying multiple filenames. They are interpreted by the shell and can be used with most common Linux filesystem commands.
cat -n
cat option that will number the lines of a file
Kate wants to compare two text files to identify what might have been changed from one version to another. Which command can she use to do this?
diff document1.txt document2.txt
The tac command _____.
displays the contents of a file in reverse order, last line first and first line last
log files
file that contains past system events
What will the following wildcard regular expression return: file[a-c]?
filea, fileb, filec
To view lines that start with the word "I," you can enter the following command:
grep " ^I " project4
To view lines that contain the word "toe" or "the" or "tie," you can enter the following command:
grep " t.e " project4
Chase is trying to extract records for employees 423 through 428 out of a comma separated values file and store them in another one. Which of the following commands would accomplish this? (Choose all that apply.) a. cat employees.csv | grep 423,424,425,426,427,428 > employees.csv b. cat employees.csv | grep "42[3-8]" > employees-newhires.csv c. grep "42[3-8]" employees.csv > employees-newhires.csv d. grep "42[3-8]" < employees.csv > employees-newhires.csv
grep "42[3-8]" employees.csv > employees-newhires.csv cat employees.csv | grep "42[3-8]" > employees-newhires.csv grep "42[3-8]" < employees.csv > employees-newhires.csv
Jo has received a text file which contains multiple instances of his name spelled correctly as well as multiple instances spelled as Joe. Which of the following commands would search a text file for any occurrences of either spelling and display them out to the terminal? (Choose three.) a. grep "Joe?" document1.txt b. grep -E "Joe?" document1.txt c. grep "Joe*" document1.txt d. grep -E "Joe*" document1.txt
grep "Joe*" document1.txt grep -E "Joe*" document1.txt grep -E "Joe?" document1.txt
Garrett wants to search through a csv file to find all rows that have either the name John or Bob in them and display them out to the terminal. Which of the following commands could Garrett use to perform this search? a. grep -E "(John|Bob)" salesemployees.csv b. grep (John|Bob) salesemployees.csv c. grep -E (John|Bob) salesemployees.csv d. egrep (John|Bob) salesemployees.csv
grep -E "(John|Bob)" salesemployees.csv
Which of the following commands will not interpret regular expressions, which translates into faster results being returned? (Choose all that apply.) a. grep b. grep -F c. egrep d. fgrep
grep -F fgrep
shell script
is a text file containing a list of commands or constructs for the shell to execute. It may contain any command that can be entered on the command line.
ls -a
list all files and directories
ls
list files in a given directory
ls -l
lists all contents in long format
cd..
move back a directory
Another important note to keep in mind regarding text tools such as grep is that they match only ______________; they are unable to discern ____________ unless they are specified.
patterns of text ; words or phrases // ex. grep "we" project4
pwd
print working directory
Which command searches for and displays any text contents of a binary file?
strings
A user types the command head /poems/mary. What will be displayed on the terminal screen?
the first 10 lines of the file mary
ls -F
used to put a slash after each directory, asterisk after each executable, nothing after others
Text editors come in two varieties: editors that can be used on the command line, including ______, ______, and ______, and editors that can be used in a GUI environment, including _________ (graphical version) and ______.
vi (vim), nano, Emacs Emacs, gedit