awk /findme/ {print $1}' file1 is equivalent to which combination of commands? grep 'findme' file1 |...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
awk /findme/ {print $1}' file1 is equivalent to which combination of commands? grep 'findme' file1 | awk '{print $1}' O awk '{print $1}' file1 | grep 'findme' Ogrep 'findme' | awk '{print $1}' file1 O awk '{print $1}' | grep 'findme' file1 QUESTION 2 Which command will display the contents of /etc/passwd correctly sorted by UID (3rd column)? O sort -rn /etc/passwd O cat /etc/passwd | sort sort -t':' -k3 -n /etc/passwd Osort -k':' -t3 -n /etc/passwd QUESTION 3 Which option allows 'sort to sort by number rather than alphabetically? -r -n -R -u QUESTION 4 You can use the sed command to perform find/replace substitution or to delete unwanted lines of text. True False QUESTION 5 You can send the standard output of one command to another command as standard input using the O a. < O b.> C. I d. # QUESTION 6 echo "hello" >filel 1>&2 2>file2 Where does the text "hello" end up? O STDIN O the screen O file1 O file2 shell metacharacter. QUESTION 7 What character is used to delimit fields in the Linux user and group database files, /etc/passwd and /etc/group? O a. space O b. colon O c. semicolon O d. tab QUESTION 8 Linux commands can be combined in three main ways. Match each with the correct description. B. shell script A. shell pipe C. subcommand A. sends the STDOUT of one command as STDIN of another B. an executable text file containing a sequence of commands that can be run as a command itself C. substitutes the output of one command as a command-line argument of another QUESTION 9 When combining commands in a pipeline, the processing typically follows what order? perform any manipulation on the selected data (e.g. `sed' or 'awk') get raw data into the pipeline (e.g. `cat file`, or some other command that produces your starting data) filter the stream down to what you're interested in (e.g. zero or more grep`s) save or append the resulting output to a file (i.e. with > or >>) QUESTION 10 Which command will count the number of currently mounted filesystems? O wc | mount O mount | wc -W O mount | wc -l O mount | wc -C QUESTION 11 Which commands will allow you to select specific columns of output? (choose all that apply) sort WC cut sed grep tr awk QUESTION 12 The file descriptor stdin is represented by the number a. 0 b. 1 C. 2 O d. 3 QUESTION 13 Which option do you need to supply to `awk` to tell it which character delimits columns in the source data? -F -f -D -d QUESTION 14 You can redirect the contents of a file to the standard input of a command using the a. | b. < O C. > O d. # metacharacter. QUESTION 15 It is a good idea to build compound commands one step at a time, testing with each new addition to the pipeline. For example 1. cat file 2. cat file | grep something 3. cat file | grep something | sed s/find/replace/g 4. cat file | grep something | sed s/find/replace/g > file2 True False QUESTION 16 allows you to duplicate stdout, sending it to the screen or a file as well as pipe it to another command. a. |& b.tee C. > d. &> QUESTION 17 You can use the BASH shell to redirect standard output from the terminal screen to a file on the filesystem using the by the absolute or relative pathname of the file. O a. # O b.> O C. < O d.l QUESTION 18 Are both standard output and standard error displayed on the terminal screen by default? O a. Yes O b. No shell metacharacter followed QUESTION 19 To append stdout to a file, use O a. < b. >> O c.l d. append O e.> O f. tee QUESTION 20 Sends both stdout and stderr of cmd to file: O a. cmd 2> file b.cmd &> file c. cmd |& file O d. cmd > file 1>&2 QUESTION 21 Which option causes `grep` to select lines that DON'T contain the given pattern? -V -d -e QUESTION 22 In what order are multiple I/O redirections (>, >>, QUESTION 23 Match each term with the correct statement below. d. Labels representing command input and output. b. Any error messages generated by a command. c. The information that is processed by the command during execution. a. The normal output of a command. a. stdout b. stderr c. stdin d. file descriptors QUESTION 24 Which command would show lines from file1 containing "banana", "Banana", or "BANANAS!!!"? grep -i 'banana' file1 grep 'BANANAS' file 1 grep -i 'BANANAS' file1 grep 'banana' file1 QUESTION 25 The command counts the number of lines, words, and characters in a file. atr b.wc c. pr d.nl QUESTION 26 Which is the equivalent of `cat file | cmd"? a. cmd > file b.file > cmd O c. file < cmd O d.cmd < file QUESTION 27 The file descriptor stderr is represented by the number O a. 0 b. 1 C. 2 d. 3 QUESTION 28 Which of these represent the use of a subcommand? (choose all that apply) echo "I am $(whoami)" echo "I am (whoami)" echo "I am {whoami}" echo "I am $whoami" echo "I am ${whoami}" echo "I am whoami" QUESTION 29 cat /etc/resolv.conf | grep 'nameserver' | awk '{print $2}' | sort -n >> nameservers.txt What does this command do? O filters out all lines containing "nameserver", isolates the IP address column, sorts the IPs numerically, and appends the results to a file. O selects only the second column where the value of the second column is "nameserver", then writes those values to a new file. O reads the file nameservers.txt, sorts it by number, selects the second column, filters out lines where that column is "nameserver", then writes the output to a file called /etc/resolv.conf. QUESTION 30 Filter command that prints lines from STDIN that match a given pattern to STDOUT: O a.tr b.grep O c. sed O d. cut QUESTION 31 Which command will make a backup copy of file1 and replace all instances of Matt with Matthew in the original copy of file1? O sed 's/Matt/Matthew/g' file 1 O sed -i.bak 's/Matt/Matthew/g' file1 O file1 | sed -i.bak 's/Matt/Matthew/g' O file1 | sed 's/Matt/Matthew/g' QUESTION 32 The command can be used to extract, manipulate, and format text using pattern-action statements. (Commonly used to select columns and/or rows from its input.) O a. grep Ob.awk c. nl O d. sed QUESTION 33 The file descriptor stdout is represented by the number O a.0 b.1 O c. 2 O d. 3 QUESTION 34 [root@md-fc13 ~]# ping -c 5 www.google.com PING www.google.com (173.194.77.106) 56 (84) bytes of data. 64 bytes from ob-in-f106. le100.net (173.194.77.106): icmp_seq=1 ttl-47 time=20.8 ms 64 bytes from ob-in-f106.1e100.net 64 bytes from ob-in-f106.1e100.net 64 bytes from ob-in-f106.1e100.net 64 bytes from ob-in-f106.1e100.net www.google.com ping statistics (173.194.77.106): icmp_seq=2 ttl-47 time=20.7 ms (173.194.77.106): icmp_seq-3 ttl=47 time=20.8 ms (173.194.77.106): icmp_seq=4 ttl=47 time=20.8 ms (173.194.77.106): icmp_seq=5 ttl=47 time=20.7 ms --- --- 5 packets transmitted, 5 received, 0% packet loss, time 4028ms rtt min/avg/max/mdev = 20.790/20.823/20.873/0.030 ms Which command would display just the overall packet loss percentage? awk -F',' '/packet loss/ {print $3}' $ (ping -c 5 www.google.com) | awk '{print $1}' O ping -c 5 www.google.com | awk -F', '/packet loss/ {print $3}' | awk '{print $1}' ping - 5 www.google.com | awk '{print $1}'| awk -F',' '/packet loss/ {print $3}' awk -F',' '/packet loss/ {print $3}' | awk '{print $1} $(ping -c 5 www.google.com) QUESTION 35 Why should you always enclose your `grep` search patterns, `sed substitution rules, and awk programs in single quotes? (e.g. `grep -v '\?*' file as opposed to `grep -v \?* file) O Some characters have special meaning for both the bash' shell and the command being run. To avoid confusion, quoting will force the shell to pass a literal string to the command. O They are required by "grep`, `sed', and 'awk. O They are required by "bash'. QUESTION 36 The general format of a 'sed substitution is Os/findme/replacewith/g O s/replacewith/findme/g O g/replacewith/findme/s O g/findme/replacewith/s QUESTION 37 *sed 's/Matt/Matthew/g' file1` modifies file1 (i.e. changes the contents on disk). True O False QUESTION 38 Which command would show only lines containing "/dev/sda" in the output of `mount? grep '/dev/sda' mount grep mount '/dev/sda' mount '/dev/sda' | grep mount | grep '/dev/sda' QUESTION 39 How does a subcommand "pass" its output to the enclosing/outer command (e.g. in the command 'echo $(subcommand)`) O The shell redirects STDOUT of the subcommand to STDIN of the outer command. O The subcommand is executed first and the shell substitutes the subcommand's output as one of the command-line arguments for the outer command. O The shell redirects STDIN of the subcommand to STDOUT of the outer command. O The outer command is executed first and the shell runs the subcommand each time it appears in the outer command's output. QUESTION 40 For more complex tasks, most Linux admins move up from piped combinations of commands to which scripting language(s)? (choose all that apply) Python C# OLISP Java O Perl awk /findme/ {print $1}' file1 is equivalent to which combination of commands? grep 'findme' file1 | awk '{print $1}' O awk '{print $1}' file1 | grep 'findme' Ogrep 'findme' | awk '{print $1}' file1 O awk '{print $1}' | grep 'findme' file1 QUESTION 2 Which command will display the contents of /etc/passwd correctly sorted by UID (3rd column)? O sort -rn /etc/passwd O cat /etc/passwd | sort sort -t':' -k3 -n /etc/passwd Osort -k':' -t3 -n /etc/passwd QUESTION 3 Which option allows 'sort to sort by number rather than alphabetically? -r -n -R -u QUESTION 4 You can use the sed command to perform find/replace substitution or to delete unwanted lines of text. True False QUESTION 5 You can send the standard output of one command to another command as standard input using the O a. < O b.> C. I d. # QUESTION 6 echo "hello" >filel 1>&2 2>file2 Where does the text "hello" end up? O STDIN O the screen O file1 O file2 shell metacharacter. QUESTION 7 What character is used to delimit fields in the Linux user and group database files, /etc/passwd and /etc/group? O a. space O b. colon O c. semicolon O d. tab QUESTION 8 Linux commands can be combined in three main ways. Match each with the correct description. B. shell script A. shell pipe C. subcommand A. sends the STDOUT of one command as STDIN of another B. an executable text file containing a sequence of commands that can be run as a command itself C. substitutes the output of one command as a command-line argument of another QUESTION 9 When combining commands in a pipeline, the processing typically follows what order? perform any manipulation on the selected data (e.g. `sed' or 'awk') get raw data into the pipeline (e.g. `cat file`, or some other command that produces your starting data) filter the stream down to what you're interested in (e.g. zero or more grep`s) save or append the resulting output to a file (i.e. with > or >>) QUESTION 10 Which command will count the number of currently mounted filesystems? O wc | mount O mount | wc -W O mount | wc -l O mount | wc -C QUESTION 11 Which commands will allow you to select specific columns of output? (choose all that apply) sort WC cut sed grep tr awk QUESTION 12 The file descriptor stdin is represented by the number a. 0 b. 1 C. 2 O d. 3 QUESTION 13 Which option do you need to supply to `awk` to tell it which character delimits columns in the source data? -F -f -D -d QUESTION 14 You can redirect the contents of a file to the standard input of a command using the a. | b. < O C. > O d. # metacharacter. QUESTION 15 It is a good idea to build compound commands one step at a time, testing with each new addition to the pipeline. For example 1. cat file 2. cat file | grep something 3. cat file | grep something | sed s/find/replace/g 4. cat file | grep something | sed s/find/replace/g > file2 True False QUESTION 16 allows you to duplicate stdout, sending it to the screen or a file as well as pipe it to another command. a. |& b.tee C. > d. &> QUESTION 17 You can use the BASH shell to redirect standard output from the terminal screen to a file on the filesystem using the by the absolute or relative pathname of the file. O a. # O b.> O C. < O d.l QUESTION 18 Are both standard output and standard error displayed on the terminal screen by default? O a. Yes O b. No shell metacharacter followed QUESTION 19 To append stdout to a file, use O a. < b. >> O c.l d. append O e.> O f. tee QUESTION 20 Sends both stdout and stderr of cmd to file: O a. cmd 2> file b.cmd &> file c. cmd |& file O d. cmd > file 1>&2 QUESTION 21 Which option causes `grep` to select lines that DON'T contain the given pattern? -V -d -e QUESTION 22 In what order are multiple I/O redirections (>, >>, QUESTION 23 Match each term with the correct statement below. d. Labels representing command input and output. b. Any error messages generated by a command. c. The information that is processed by the command during execution. a. The normal output of a command. a. stdout b. stderr c. stdin d. file descriptors QUESTION 24 Which command would show lines from file1 containing "banana", "Banana", or "BANANAS!!!"? grep -i 'banana' file1 grep 'BANANAS' file 1 grep -i 'BANANAS' file1 grep 'banana' file1 QUESTION 25 The command counts the number of lines, words, and characters in a file. atr b.wc c. pr d.nl QUESTION 26 Which is the equivalent of `cat file | cmd"? a. cmd > file b.file > cmd O c. file < cmd O d.cmd < file QUESTION 27 The file descriptor stderr is represented by the number O a. 0 b. 1 C. 2 d. 3 QUESTION 28 Which of these represent the use of a subcommand? (choose all that apply) echo "I am $(whoami)" echo "I am (whoami)" echo "I am {whoami}" echo "I am $whoami" echo "I am ${whoami}" echo "I am whoami" QUESTION 29 cat /etc/resolv.conf | grep 'nameserver' | awk '{print $2}' | sort -n >> nameservers.txt What does this command do? O filters out all lines containing "nameserver", isolates the IP address column, sorts the IPs numerically, and appends the results to a file. O selects only the second column where the value of the second column is "nameserver", then writes those values to a new file. O reads the file nameservers.txt, sorts it by number, selects the second column, filters out lines where that column is "nameserver", then writes the output to a file called /etc/resolv.conf. QUESTION 30 Filter command that prints lines from STDIN that match a given pattern to STDOUT: O a.tr b.grep O c. sed O d. cut QUESTION 31 Which command will make a backup copy of file1 and replace all instances of Matt with Matthew in the original copy of file1? O sed 's/Matt/Matthew/g' file 1 O sed -i.bak 's/Matt/Matthew/g' file1 O file1 | sed -i.bak 's/Matt/Matthew/g' O file1 | sed 's/Matt/Matthew/g' QUESTION 32 The command can be used to extract, manipulate, and format text using pattern-action statements. (Commonly used to select columns and/or rows from its input.) O a. grep Ob.awk c. nl O d. sed QUESTION 33 The file descriptor stdout is represented by the number O a.0 b.1 O c. 2 O d. 3 QUESTION 34 [root@md-fc13 ~]# ping -c 5 www.google.com PING www.google.com (173.194.77.106) 56 (84) bytes of data. 64 bytes from ob-in-f106. le100.net (173.194.77.106): icmp_seq=1 ttl-47 time=20.8 ms 64 bytes from ob-in-f106.1e100.net 64 bytes from ob-in-f106.1e100.net 64 bytes from ob-in-f106.1e100.net 64 bytes from ob-in-f106.1e100.net www.google.com ping statistics (173.194.77.106): icmp_seq=2 ttl-47 time=20.7 ms (173.194.77.106): icmp_seq-3 ttl=47 time=20.8 ms (173.194.77.106): icmp_seq=4 ttl=47 time=20.8 ms (173.194.77.106): icmp_seq=5 ttl=47 time=20.7 ms --- --- 5 packets transmitted, 5 received, 0% packet loss, time 4028ms rtt min/avg/max/mdev = 20.790/20.823/20.873/0.030 ms Which command would display just the overall packet loss percentage? awk -F',' '/packet loss/ {print $3}' $ (ping -c 5 www.google.com) | awk '{print $1}' O ping -c 5 www.google.com | awk -F', '/packet loss/ {print $3}' | awk '{print $1}' ping - 5 www.google.com | awk '{print $1}'| awk -F',' '/packet loss/ {print $3}' awk -F',' '/packet loss/ {print $3}' | awk '{print $1} $(ping -c 5 www.google.com) QUESTION 35 Why should you always enclose your `grep` search patterns, `sed substitution rules, and awk programs in single quotes? (e.g. `grep -v '\?*' file as opposed to `grep -v \?* file) O Some characters have special meaning for both the bash' shell and the command being run. To avoid confusion, quoting will force the shell to pass a literal string to the command. O They are required by "grep`, `sed', and 'awk. O They are required by "bash'. QUESTION 36 The general format of a 'sed substitution is Os/findme/replacewith/g O s/replacewith/findme/g O g/replacewith/findme/s O g/findme/replacewith/s QUESTION 37 *sed 's/Matt/Matthew/g' file1` modifies file1 (i.e. changes the contents on disk). True O False QUESTION 38 Which command would show only lines containing "/dev/sda" in the output of `mount? grep '/dev/sda' mount grep mount '/dev/sda' mount '/dev/sda' | grep mount | grep '/dev/sda' QUESTION 39 How does a subcommand "pass" its output to the enclosing/outer command (e.g. in the command 'echo $(subcommand)`) O The shell redirects STDOUT of the subcommand to STDIN of the outer command. O The subcommand is executed first and the shell substitutes the subcommand's output as one of the command-line arguments for the outer command. O The shell redirects STDIN of the subcommand to STDOUT of the outer command. O The outer command is executed first and the shell runs the subcommand each time it appears in the outer command's output. QUESTION 40 For more complex tasks, most Linux admins move up from piped combinations of commands to which scripting language(s)? (choose all that apply) Python C# OLISP Java O Perl
Expert Answer:
Related Book For
Posted Date:
Students also viewed these computer network questions
-
You are 25 years old and have just finished your degree work for 50 years and each month save a constant amount towards your retirement. You plan to You estimate that by the time you retire the life...
-
Trail Holdings, a winemaker located in the Okanagan Valley, is considering opening a new distribution centre in Montreal. Trail will have to spend $250,000 on new equipment and invest $100,000 in net...
-
On December 31, 2021, Tiny Tims Tech, Inc. a private company who follows ASPE, leased a colour copier from Cory Copy Corporation at a price of $479,079. The lease agreement specifies annual payments...
-
Research the history of process costing in the United States. When did it begin to be used in manufacturing companies? What type of company would use a process costing system? Investigate process...
-
Using the SRK equation of state (or any other cubic equation of state) to determine a specific volume from a specified temperature and pressure requires a trial-and-error calculation. Three computer-...
-
Growing Green Gardens (GGG) runs a service that maintains gardens and landscaping for industrial companies. GGG charges its customers \($3200\) a month for the service and tax invoices are prepared...
-
Huff Company presents the following items derived from its December 31, 2016, adjusted trial balance: The following information is also available for 2016 and is not reflected in the preceding...
-
i need help with this question with an explanation thanks! 7) Large Co. pays its employees $20,000 gross salary each week. 30% of salary is withheld for income taxes and 5% is withheld to pay Social...
-
What is market positioning in regards to a total rewards package? Select the most correct answer from the following: a) the monetary rewards an organization provides for a specific set of KSAs in...
-
What does supplanting mean in grant terms. Are criminal justice organizations authorized to supplant with grant funds? Why or why not?
-
The textbook describes three areas in which ERP systems benefit organisations. What are these?
-
Kowalczyk Company spends $30000 dollars for manufacturing equipment. When should the cost of the equipment be expensed? Over the period that the equipment will be used When the performance obligation...
-
explain the Store layout & Navigation (The 'store layout' in terms of an online retailer refers to the the layout of each page on that website, as well as the 'links' (or navigation process) to move...
-
Company borrowed $5,000 on October 1, Year 1. The note had a one-year term and an annual interest rate of 6%. On December 31, Year 1 Gamma ognized accrued interest expense of $ (Enter your answer as...
-
find the center of gravity of body as shown in fig 1 2n 9n 4ft Fig 1
-
For the following exercises, write the first four terms of the sequence. a n = 2 n 2
-
Describe the path of urine and the structure and function of each organ mentioned?
-
Tracing the path of food in the following list (a-f). which step is out of order first? a. Mouth b. Pharynx c. Esophagus d. Small intestine e. Stomach f. Large intestine
-
What type of epithelial tissue is found in the walls of the urinary bladder to provide it with the ability to distend? a. Simple cuboidal epithelium b. Transitional epithelium c. Pseudostratified...
-
Consider the \(\operatorname{ARDL}(p, q)\) equation and the data in the file usmacro. For \(p=2\) and \(q=1\), results from the LM test for serially correlated errors were reported in Table 9.6 for...
-
Consider the data file \(m r o z\) on working wives. Use the 428 observations on married women who participate in the labor force. In this exercise, we examine the effectiveness of a parent's college...
-
Consider the data file \(m r o z\) on working wives. Use the 428 observations on married women who participate in the labor force. In this exercise, we examine the effectiveness of a parent's college...
Study smarter with the SolutionInn App