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:
- B) file
- D) cat
- A) less
- B) ten
- A) i and ii only
- B) Type forward slash(/) then type the word to search
- B) paste file1.txt file2.txt
- A) sort
- C) stat
- B) wc
- D) cut -f2 infotech.txt
- C) touch
- A) nl
- C) aspell -c infotech.txt
- D) lpr
- A) more
- C) comm
- B) cmp
- C) grep
- B) look