CompTIA Linux+ [Powered by LPI] Exam 1 v6.0 (LX0-103)

Page:    1 / 8   
Total 120 questions

Which of the following commands will reduce all consecutive spaces down to a single space?

  • A. tr '\s' ' ' < a.txt > b.txt
  • B. tr -c ' ' < a.txt > b.txt
  • C. tr -d ' ' < a.txt > b.txt
  • D. tr -r ' ' '\n' < a.txt > b.txt
  • E. tr -s ' ' < a.txt > b.txt


Answer : E

From a Bash shell, which of the following commands directly executes the instruction from the file /usr/local/bin/runme.sh without starting a subshell? (Please select TWO answers.)

  • A. source /usr/local/bin/runme.sh
  • B. . /usr/local/bin/runme.sh
  • C. /bin/bash /usr/local/bin/runme.sh
  • D. /usr/local/bin/runme.sh
  • E. run /usr/local/bin/runme.sh


Answer : A,B

Which of the following commands replaces each occurrence of 'bob' in the file letter with
'Bob' and writes the result to the file newletter?

  • A. sed '/bob/Bob' letter > newletter
  • B. sed s/bob/Bob/ letter < newletter
  • C. sed 's/bob/Bob' letter > newletter
  • D. sed 's/bob/Bob/g' letter > newletter
  • E. sed 's/bob, Bob/' letter > newletter


Answer : D

Which character, added to the end of a command, runs that command in the background as a child process of the current shell?

  • A. !
  • B. +
  • C. &
  • D. %
  • E. #


Answer : C

Which variable defines the directories in which a Bash shell searches for executable commands?

  • A. BASHEXEC
  • B. BASHRC
  • C. PATH
  • D. EXECPATH
  • E. PATHRC


Answer : C

Immediately after deleting 3 lines of text in vi and moving the cursor to a different line, which single character command will insert the deleted content below the current line?

  • A. i (lowercase)
  • B. P (uppercase)
  • C. p (lowercase)
  • D. U (uppercase)
  • E. u (lowercase)


Answer : C

What command will generate a list of user names from /etc/passwd along with their login shell?

  • A. column -s : 1,7 /etc/passwd
  • B. chop -c 1,7 /etc/passwd
  • C. colrm 1,7 /etc/passwd
  • D. cut -d: -f1,7 /etc/passwd


Answer : D

Which of the following files, located in the user home directory, is used to store the Bash history?

  • A. .bash_history
  • B. .bash_histfile
  • C. .history
  • D. .bashrc_history
  • E. .history_bash


Answer : A

What is the default nice level when a process is started using the nice command?

  • A. -10
  • B. 10
  • C. 20
  • D. 0


Answer : B

Which of the following commands prints a list of usernames (first column) and their primary group (fourth column) from the /etc/passwd file?

  • A. fmt -f 1,4 /etc/passwd
  • B. split -c 1,4 /etc/passwd
  • C. cut -d : -f 1,4 /etc/passwd
  • D. paste -f 1,4 /etc/passwd


Answer : C

Which of the following commands determines the type of a file by using a definition database file which contains information about all common file types?

  • A. magic
  • B. type
  • C. file
  • D. pmagic
  • E. hash


Answer : C

Which of the following commands moves and resumes in the background the last stopped shell job?

  • A. run
  • B. bg
  • C. fg
  • D. back


Answer : B

Which of the following command sets the Bash variable named TEST with the content
FOO?

  • A. set TEST="FOO"
  • B. TEST = "FOO"
  • C. var TEST="FOO"
  • D. TEST="FOO"


Answer : D

When running the command -
sed -e "s/a/b/" /tmp/file >/tmp/file
While/tmp/file contains data, why is /tmp/file empty afterwards?

  • A. The file order is incorrect. The destination file must be mentioned before the command to ensure redirection.
  • B. The command sed did not match anything in that file therefore the output is empty.
  • C. When the shell establishes the redirection it overwrites the target file before the redirected command starts and opens it for reading.
  • D. Redirection for shell commands do not work using the > character. It only works using the | character instead.


Answer : C

What is the output of the following command?
echo "Hello World" | tr -d aieou

  • A. Hello World
  • B. eoo
  • C. Hll Wrld
  • D. eoo Hll Wrld


Answer : C

Page:    1 / 8   
Total 120 questions