linux foundation LFCS Exam Questions

Questions for the LFCS were updated on : Nov 21 ,2025

Page 1 out of 18. Viewing questions 1-15 out of 260

Question 1

Which of the following commands can be used to extract content from a tar file?

  • A. tar -xvf
  • B. tar -vf
  • C. tar -e
  • D. tar -c
  • E. tar –v
Answer:

A

User Votes:
A
50%
B
50%
C
50%
D
50%
E
50%
Discussions
vote your answer:
A
B
C
D
E
0 / 1000

Question 2

How can the normal output of a command be written to a file while discarding the error output?

  • A. command >2>file 1&>/dev/null
  • B. command < output > /dev/null
  • C. command > discard-error > file
  • D. command > /dev/null 2&>1 output
  • E. command >file 2>/dev/null
Answer:

E

User Votes:
A
50%
B
50%
C
50%
D
50%
E
50%
Discussions
vote your answer:
A
B
C
D
E
0 / 1000

Question 3

Which command will display the last line of the file foo.txt?

  • A. head -n 1 foo.txt
  • B. tail foo.txt
  • C. last -n 1 foo.txt
  • D. tail -n 1 foo.txt
Answer:

D

User Votes:
A
50%
B
50%
C
50%
D
50%
Discussions
vote your answer:
A
B
C
D
0 / 1000

Question 4

What is the output of the following command?
for token in a b c; do
echo -n ${token};
done

  • A. anbncn
  • B. abc
  • C. $token$token$token
  • D. {a}{b}{c}
  • E. a b c
Answer:

B

User Votes:
A
50%
B
50%
C
50%
D
50%
E
50%
Discussions
vote your answer:
A
B
C
D
E
0 / 1000

Question 5

Which of the following commands will create an archive file, named backup.tar, containing all the
files from the directory /home?

  • A. tar /home backup.tar
  • B. tar -cf /home backup.tar
  • C. tar -xf /home backup.tar
  • D. tar -xf backup.tar /home
  • E. tar -cf backup.tar /home
Answer:

E

User Votes:
A
50%
B
50%
C
50%
D
50%
E
50%
Discussions
vote your answer:
A
B
C
D
E
0 / 1000

Question 6

Which of the following commands will set the variable text to olaf is home? (Choose two)

  • A. text=olaf\ is\ home
  • B. text=$olaf is home
  • C. $text='olaf is home'
  • D. text=='olaf is home'
  • E. text="olaf is home"
Answer:

A, E

User Votes:
A
50%
B
50%
C
50%
D
50%
E
50%
Discussions
vote your answer:
A
B
C
D
E
0 / 1000

Question 7

How can the current directory and its subdirectories be searched for the file named MyFile.xml?

  • A. find . -name MyFile.xml
  • B. grep MyFile.xml | find
  • C. grep -r MyFile.xml .
  • D. less MyFile.xml
  • E. search Myfile.xml ./
Answer:

A

User Votes:
A
50%
B
50%
C
50%
D
50%
E
50%
Discussions
vote your answer:
A
B
C
D
E
0 / 1000

Question 8

What two character sequence is present at the beginning of an interpreted script? (Please specify the
TWO correct characters only)

Answer:

#!

User Votes:
Discussions
vote your answer:
0 / 1000

Question 9

The output of the program date should be saved in the variable actdat. What is the correct
statement?

  • A. actdat=`date`
  • B. set actdat='date'
  • C. date | actdat
  • D. date > $actdat
  • E. actdat=date
Answer:

A

User Votes:
A
50%
B
50%
C
50%
D
50%
E
50%
Discussions
vote your answer:
A
B
C
D
E
0 / 1000

Question 10

Which of the following commands will output all of the lines with the name Fred in upper or lower
case but not the word red from the file data_file? (Choose two)

  • A. grep -v fred data_file
  • B. grep '[f]red' data_file
  • C. egrep fred data_file
  • D. grep '[Ff]red' data_file
  • E. grep -i fred data_file
Answer:

D, E

User Votes:
A
50%
B
50%
C
50%
D
50%
E
50%
Discussions
vote your answer:
A
B
C
D
E
0 / 1000

Question 11

What does the exit status 0 indicate about a process?

  • A. The process ended without any problems.
  • B. The process was terminated by the user.
  • C. The process couldn't finish correctly.
  • D. The process waited for an input but got none.
  • E. The process finished in time.
Answer:

A

User Votes:
A
50%
B
50%
C
50%
D
50%
E
50%
Discussions
vote your answer:
A
B
C
D
E
0 / 1000

Question 12

Which of the following commands redirects the output of cmd to the file foo.txt, in which an existing
file is overwritten?

  • A. cmd || foo.txt
  • B. cmd | foo.txt
  • C. cmd && foo.txt
  • D. cmd >> foo.txt
  • E. cmd > foo.txt
Answer:

E

User Votes:
A
50%
B
50%
C
50%
D
50%
E
50%
Discussions
vote your answer:
A
B
C
D
E
0 / 1000

Question 13

Which of the following command sequences overwrites the file foobar.txt?

  • A. echo "QUIDQUIDAGIS" >> foobar.txt
  • B. echo "QUIDQUIDAGIS" < foobar.txt
  • C. echo "QUIDQUIDAGIS" > foobar.txt
  • D. echo "QUIDQUIDAGIS" | foobar.txt
Answer:

C

User Votes:
A
50%
B
50%
C
50%
D
50%
Discussions
vote your answer:
A
B
C
D
0 / 1000

Question 14

Which command chain will count the number of regular files with the name of foo.txt within /home?

  • A. ls -lR /home | grep foo.txt | wc -l
  • B. find /home -type f -name foo.txt | wc -l
  • C. find /home -name foo.txt -count
  • D. find /home -name foo.txt | wc -l
  • E. grep -R foo.txt /home | wc -l
Answer:

B

User Votes:
A
50%
B
50%
C
50%
D
50%
E
50%
Discussions
vote your answer:
A
B
C
D
E
0 / 1000

Question 15

What is the correct command to extract the contents of the archive file download.bz2?

  • A. unpack download.bz2
  • B. unzip2 download.bz2
  • C. bunzip2 download.bz2
  • D. unzip download.bz2
  • E. uncompress download.bz2
Answer:

C

User Votes:
A
50%
B
50%
C
50%
D
50%
E
50%
Discussions
vote your answer:
A
B
C
D
E
0 / 1000
To page 2