Shared Flashcard Set

Details

Linux Essentials 3.2
Searching for and Extracting Data from Files
30
Computer Science
Professional
04/06/2020

Additional Computer Science Flashcards

 


 

Cards

Term
3.2 - Name the standard channels and their Linux names?
Definition
Standard input = stdin(channel 0), standard output = stdout(channel 1), standard error output = stderr(channel 2)
Term
3.2 - How can you set the standard error output?
Definition
By using the "2>" operator
Example: find /usr games 2> text-error
Term
3.2 - How do you redirect the standard output (channel 1) to a file?
Definition
By using the ">" operator
Example: top > result.txt
Term
3.2 - How do you append information to a file?
Definition
Use the ">>" operator.
Example: echo "This is my additional information" >> my-file.txt
Term
3.2 - How do you combine the redirection of standard output and input?
Definition
Using the "<>" operator
Term
3.2 - What does the "grep -i" switch do?
Definition
Makes the search case insensitive
Term
3.2 - What does the "grep -r" switch do?
Definition
Makes the search recursive (it searches into all files within the given directory and its subdirectory)
Term
3.2 - What does the "grep -c" switch do?
Definition
Makes the search counts the number of matches
Term
3.2 - What does the "grep -v" switch do?
Definition
Makes the search invert the match, to print lines that do not match the search term
Term
3.2 - What does the "grep -E" switch do?
Definition
Turns on extended regular expressions (needed by some of the more advanced meta-characters like "|", "+", "?")
Term
3.2 - What does the regex character "[^abcABC]" match (quotations not included)
Definition
Match any one character except the ones in the brackets
Term
3.2 - What does the regex character "[a-z]" match (quotations not included)
Definition
Match any character in the range
Term
3.2 - What does the regex character "[^a-z]" match (quotations not included)
Definition
Match any character except the ones in the range
Term
3.2 - What does the regex character "^" do? (quotations not included)
Definition
Start of a line
Term
3.2 - What does the regex "$" character do?
Definition
End of a line
Term
3.2 - Where should the "^" regex meta-character need to be placed?
Definition
Before the expression
Example: grep "^a" and not grep "a^"
This is the beginning of a line so it is placed before the expression
Term
3.2 - Where does the "$" regex meta-character need to be placed?
Definition
After the expression
Example: grep "a$" and not grep "$a"
This is the end of a line so it is placed at the end of the expression
Term
3.2 - What is the "grep -i" switch?
Definition
Makes the search case insensitive
Term
3.2 - What is the "grep -r" switch?
Definition
Make the search recursive (searches all files within the given directory)
Term
3.2 - What is the "grep -c" switch?
Definition
Counts the numbers of matches
Term
3.2 - What is the "grep -v" switch?
Definition
Inverts the match, to print lines that do not match the search
Term
3.2 - What is the "grep -E" switch?
Definition
Turns on extended regular expressions
Term
3.2 - What does the "." regular expression do?
Definition
Match any single character
Term
3.2 - What does the "[abcABC]" regular expression do?
Definition
Match any one character within the brackets
Term
3.2 - What does the "[^abcABC]" regular expression do?
Definition
Match any one characters EXCEPT the ones in the bracket
Term
3.2 - What does the "[a-z]" regular expression do?
Definition
Match any character in the range within the brackets
Term
3.2 - What does the "[^a-e]" regular expression do?
Definition
Match an character except the ones in the range within the brackets
Term
3.2 - What does the "sun|moon" regular expression do?
Definition
Match either of the listed strings
Term
3.2 - What does the "$" regular expression do?
Definition
Match any characters at the end of the line
Term
3.2 - What does the "^" regular expression do?
Definition
Match any character at the beginning of the line
Supporting users have an ad free experience!