LPI 101-500 practice test

LPIC-1 System Administrator Exam 101, Part 1 of 2,


Question 1

Which of the following commands redirects the output of ls to standard error?

  • A. ls >-1
  • B. ls <<ERR
  • C. ls >&2
  • D. ls >>2
  • E. ls |error
Answer:

C

Discussions

Question 2

Which wildcards will match the following filenames? (Choose two.)
ttyS0
ttyS1
ttyS2

  • A. ttyS[1-5]
  • B. tty?[0-5]
  • C. tty*2
  • D. tty[A-Z][012]
  • E. tty[Ss][02]
Answer:

B,D

Discussions

Question 3

Which of the following files, located in a user’s home directory, contains the Bash history?

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

B

Discussions

Question 4

What is true regarding the command
ls > files
if files does not exist?

  • A. The output of ls is printed to the terminal
  • B. files is created and contains the output of ls
  • C. An error message is shown and ls is not executed
  • D. The command files is executed and receives the output of ls
  • E. Any output of ls is discarded
Answer:

B

Discussions

Question 5

When redirecting the output of find to the xargs command, what option to find is useful if the
filenames contain spaces?

  • A. –rep-space
  • B. -printnul
  • C. -nospace
  • D. –ignore-space
  • E. –print0
Answer:

E

Discussions

Question 6

Which of the following commands displays the path to the executable file that would be executed
when the command foo is invoked?

  • A. lsattr foo
  • B. apropos foo
  • C. locate foo
  • D. whatis foo
  • E. which foo
Answer:

A

Discussions

Question 7

What output will be displayed when the user fred executes the following command?
echo fred $USER

  • A. fred fred
  • B. fred /home/fred/
  • C. ‘fred $USER’
  • D. fred $USER
  • E. ‘fred fred’
Answer:

A

Discussions

Question 8

Which of the following commands displays the output of the foo command on the screen and also
writes it to a file called /tmp/foodata?

  • A. foo | less /tmp/foodata
  • B. foo | cp /tmp/foodata
  • C. foo > /tmp/foodata
  • D. foo | tee /tmp/foodata
  • E. foo > stdout >> /tmp/foodata
Answer:

D

Discussions

Question 9

Which command must be entered before exiting vi to save the current file as filea.txt?

  • A. %s filea.txt
  • B. %w filea.txt
  • C. :save filea.txt
  • D. :w filea.txt
  • E. :s filea.txt
Answer:

D

Discussions

Question 10

Given the following input stream:
txt1.txt
atxt.txt
txtB.txt
Which of the following regular expressions turns this input stream into the following output stream?
txt1.bak.txt
atxt.bak.txt
txtB.bak.txt

  • A. s/^.txt/.bak/
  • B. s/txt/bak.txt/
  • C. s/txt$/bak.txt/
  • D. s/^txt$/.bak^/
  • E. s/[.txt]/.bak$1/
Answer:

B

Discussions
To page 2