CS/IT MCQ Collections

Top 20 MCQ Questions on Linux File Handling Commands

Pinterest LinkedIn Tumblr
This set of MCQ questions on Linux file handling commands includes collections of the top 20 multiple-choice questions related to Linux file handling commands such as file command, cat command, head command, tail command, paste command, sort command, stat command, touch command, grep command and look command.

Read Also: Top 20 MCQ Questions on Basic Linux Commands

1. ……………… is a Linux command that tells the type of file.
A) type f
B) file
C) file type
D) type

2. The command ………….. will display the contents of a text file on the screen.
A) screen
B) display
C) content
D) cat

3. The command ………….. will display the contents of a file on the screen a page at a time.
A) less
B) cat -p
C) file -l
D) page

4. The head command used in Linux shell will display the first ……….. lines of a file on the screen.
A) five
B) ten
C) fifteen
D) twenty

5. Which command will write the last ten lines of a file “infotech.txt” to the screen?
i. tail infotech.txt
ii. tail -10 infotech.txt
iii. last -10 infotech.txt
A) i and ii only
B) ii and iii only
C) i and iii only
D) All i, ii and iii

6. How to search the contents of a file using the “less” command?
A) Type backslash(\) then type the word to search
B) Type forward slash(/) then type the word to search
C) Type hash(#) then type the word to search
D) Press S then type the word to search

7. Which of the following command will merge the contents of two files “file1” and “file2” and display it?
A) merge file1.txt file2.txt
B) paste file1.txt file2.txt
C) display file1.txt file2.txt
D) concat file1.txt file2.txt

8. The Linux command ………….. will show lines of text sorted alphabetically.
A) sort
B) alpha
C) sort -a
D) cat -s

9. …………….. is the Linux command that will display the attributes including the filename, modify date, change time, etc. of a file or directory.
A) status
B) attrib
C) stat
D) cat -a

10. The command …………………. will show the number of lines, words, and bytes in a file.
A) wordcount
B) wc
C) count
D) count -lwb

11. The command …………………. will show the second column of a text file “infotech.txt”.
A) cut -c2 infotech.txt
B) show -f2 infotech.txt
C) show -c2 infotech.txt
D) cut -f2 infotech.txt

12. The Linux command …………………. will create a file or change the file timestamp.
A) create
B) cf
C) touch
D) cat

13. Which of the following command will show the numbers for each line of a file?
A) nl
B) ln
C) sn
D) sl

14. Which of the following command will check the spelling of the file “infotech.txt”?
A) spell infotech.txt
B) spellcheck infotech.txt
C) aspell -c infotech.txt
D) spell -c infotech.txt

15. ……………… is the Linux command that prints the file or program output.
A) prnt
B) prn
C) pfr
D) lpr

16. The Linux command ……………… will display a file or program output on one page at a time.
A) more
B) single
C) page
D) single -p

17. The command ……………… will compare two files line by line.
A) diff
B) cmp
C) comm
D) compare

18. The command ……………… will compare two files byte by byte.
A) diff
B) cmp
C) comm
D) compare

19. The ……………….. command search for a pattern in a file or program output and show all the lines that contain a specified string.
A) find
B) look
C) grep
D) search

20. The command ………………. will show the words matching a given prefix.
A) find
B) look
C) grep
D) search

Answers:

  1. B) file
  2. D) cat
  3. A) less
  4. B) ten
  5. A) i and ii only
  6. B) Type forward slash(/) then type the word to search
  7. B) paste file1.txt file2.txt
  8. A) sort
  9. C) stat
  10. B) wc
  11. D) cut -f2 infotech.txt
  12. C) touch
  13. A) nl
  14. C) aspell -c infotech.txt
  15. D) lpr
  16. A) more
  17. C) comm
  18. B) cmp
  19. C) grep
  20. B) look
Please follow and like us:
RSS
Follow by Email
X (Twitter)
Visit Us
Follow Me
YouTube
YouTube
LinkedIn
linkedIn | Top 20 MCQ Questions on Linux File Handling Commands
Share

Author

Shuseel Baral is a web programmer and the founder of InfoTechSite has over 8 years of experience in software development, internet, SEO, blogging and marketing digital products and services is passionate about exceeding your expectations.

Comments are closed.

RSS
Follow by Email
X (Twitter)
Visit Us
Follow Me
YouTube
YouTube
LinkedIn
Share