Examen 101 - LPI Chapter 1: Exploring Linux Command-Line Tools

Description

Quiz on Examen 101 - LPI Chapter 1: Exploring Linux Command-Line Tools, created by Carlos Alberto Jara Alva on 03/01/2018.
Carlos Alberto Jara Alva
Quiz by Carlos Alberto Jara Alva, updated more than 1 year ago
Carlos Alberto Jara Alva
Created by Carlos Alberto Jara Alva almost 7 years ago
105
0

Resource summary

Question 1

Question
You type a command into bash and pass a long filename to it, but after you enter the command, you receive a File not found error message because of a typo in the filename. How might you proceed?
Answer
  • Retype the command, and be sure you type the filename correctly, letter by letter
  • Retype the command, but press the Tab Key after typing a few letters of the long filename to ensure that the filename is entered correctly
  • Press the Up arrow key, and use bash's editing features to correct the typo.
  • Any of the above
  • None of the above

Question 2

Question
Which command will display the last lines of the text file file1?
Answer
  • head -b file1
  • head --bottom file1
  • head -v file1
  • tail file1
  • tail -n 1 file1

Question 3

Question
Carlos has text file named guest_list containing 12 lines. She executes the following command. What is the result? #split -4 guest_list gl
Answer
  • The first four columns in the text are written to new files glaa, glab, glac, and glad
  • The first four columns in the text are written to new files aagl, abgl, acgl and adgl.
  • The lines of guest_list are evenly divided among new files glaa, glab, glac, and glad
  • The lines of guest_list are evenly divided among new files glaa, glab and glac.
  • The lines of guest_list are evenly divided among new files aagl, abgl, acgl and adg

Question 4

Question
Which one of the following commands could be used to change all upper-case characters to lowercase in the middle of a pipe?
Answer
  • grep
  • egrep
  • wc
  • tr
  • pr

Question 5

Question
What command can display the contents of a binary file in a readable hexadecimal form? Select one.
Answer
  • xd
  • hd
  • od
  • Xd
  • dump

Question 6

Question
You want to store the standard output of the ifconfig command in a text file (file.txt) for future reference, and you want to wipe out any existing data in the file. You do not want to store standard error in this file. how can you accomplish these goals?
Answer
  • ifconfig < file.txt
  • ifconfig >> file.txt
  • ifconfig > file.txt
  • ifconfig | file.txt
  • ifconfig 2> file.txt

Question 7

Question
What is the effect of the following command? #myprog &> input.txt
Answer
  • Standard error to myprog is taken from input.txt
  • Standard input to myprog is taken from input.txt
  • Standard output and standard error from myprog are written to input.txt
  • All of the above
  • None of the above

Question 8

Question
How many commands can you pipe together at once?
Answer
  • 2
  • 3
  • 4
  • 16
  • >16

Question 9

Question
Which of the following commands will number the lines in aleph.txt (Select three.)
Answer
  • fmt aleph.txt
  • nl aleph.txt
  • cat -b aleph.txt
  • cat -n aleph.txt
  • od -nl aleph.txt

Question 10

Question
Which of the following commands will print lines from the file world.txt that contain matches to changes and changed'
Answer
  • grep change[ds] world.txt
  • sed change[d-s] world.txt
  • od "change'd|s" world.txt
  • cat world.txt changes changed
  • find world.txt "change(d|s)"

Question 11

Question
Which of the following regular expressions will match the strings dog, dug, and various other strings but not dig?
Answer
  • d.g
  • d[ou]g
  • d[o-u]g
  • di*g
  • d.ig

Question 12

Question
Which of the following files, located in the user home directory, is used to store the Bash History?
Answer
  • .bash_history
  • .bash_histfile
  • .history
  • .bashrc_history
  • .history_bash

Question 13

Question
Which of the following shell redirections will write standard output and standard error output to a file named filename?
Answer
  • 2>&1 >filename
  • >filename 2>&1
  • 1>&2>filename
  • >>filename
  • 1&2>filename

Question 14

Question
Which variable defines the directories in which a Bash shell searches for executable commands?
Answer
  • BASHEXEC
  • BASHRC
  • PATH
  • EXECPATH
  • PATHRC

Question 15

Question
Which of the following commands will send output from the program myapp to both standard output (stdout) and the file file1.log?
Answer
  • cat < myapp | cat > file1.log
  • myapp 0>&1 | cat > file1.log
  • myapp | cat > file1.log
  • myapp | tee file1.log
  • tee myapp file1.log

Question 16

Question
Which of the following commands replaces each occurrence of 'bob' in the file letter with 'Bob' and writes the result to the file newletter?
Answer
  • sed '/bob/Bob' letter > newletter
  • sed s/bob/Bob letter > newletter
  • sed 's/bob/Bob' letter > newletter
  • sed 's/bob/Bob/g' letter > newletter
  • sed 's/bob, Bob/'' letter > newletter

Question 17

Question
What command will generate a list of user names from /etc/passwd along with their login shell?
Answer
  • column -s : 1,7 /etc/passwd
  • chop -c 1,7 /etc/passwd
  • colrm 1,7 /etc/passwd
  • cut -d: -f1,7 /etc/passwd

Question 18

Question
Which of the following statements is correct regarding the command foo 1>bar?
Answer
  • The stdout from the command foo is appended to the file bar.
  • The stdout from the command foo overwrites the file bar.
  • The command foo receives its stdin from the file bar.
  • The command foo receives its stdin from the stdout of the command bar.
  • The stderr from the command foo is saved to the file bar.

Question 19

Question
Which of the following commands is implemented as an internal command in bash?
Answer
  • cat
  • less
  • tee
  • sed
  • echo

Question 20

Question
A text-mode program, verbose, prints a lot of bogus "error" messages to standard error. How might you get rid of those messages while still interacting with the program?
Answer
  • verbose | quit
  • verbose &> /dev/null
  • verbose 2> /dev/null
  • verbose > junk.txt
  • quiet-mode verbose

Question 21

Question
Which of the following commands will change all occurrences of dog in the file animals.txt to mutt in the screen display?
Answer
  • sed -s "dog" "mutt" animals.txt
  • grep -s "dog || mutt" animals.txt
  • sed 's/dog/mutt/g' animals.txt
  • cat animals.txt | grep -c "dog" "mutt"
  • fmt animals.txt | cut 'dog' > 'mutt'
Show full summary Hide full summary

Similar

GCSE Biology, Module B4
jessmitchell
CHEMISTRY CORE REVISION
Sausan Saleh
Physical Description
Mónica Rodríguez
Weimar & Nazi Germany?
Maddy Balkham
ICT GCSE flashcards
Catherine Archer
NSI FINAL TEST
brahim matrix
Coastal Development and physical processess
Corey Meehan
Comparative Studies 2016: The Plough and The Stars, Foster, The King's Speech
Lorenzo Battilocchi
2PR101 1.test - 1. část
Nikola Truong
A child with a stiff neck
fatima alkhateeb
Philosophy - p1
Temirlan Shablin