Multiple choice questions and answers (MCQs) on Linux focuses on “Managing of users accounts and groups” to prepare for exams, interviews, and certifications, such as Redhat exam, CompTIA exam, Ubuntu / SuSE certification, LPI certification exam. These MCQs will easily prepare anyone to pass their Linux test.
[st_adsense]
1. Which command is used to identify the file type?
A Type
B File
C Finfo
D Info
B
“file” command determines the type of a file. For example:
$ file *
home.htm : HTML document text
contact.htm : HTML document text
picture.gif : GIF image data, version 89a, 107 x 18
notes.txt : ASCII text, with CRLF line terminators
We use the * character to specify all the files.
2. Which option of “rm” command is used to delete a directory with all its subdirectories?
A –o
B –p
C –r
D –b
C
$ rm -r command is used to delete a directory with all its subdirectories.
3. Which command creates an empty file if the file does not exist?
A cat
B touch
C read
D ed
B
$ touch new_file command creates an empty file if the file does not exist.
4. Which command is used to copy files to and from the archive?
A gzip
B zip
C cpio
D backup
[st_adsense]
C
cpio command copies the files into an archive. It reads a list of files, one by one, from the standard input and writes the archive to the standard output.
5. Which command is used to display disk space of a specific directory?
A du
B dds
C ds
D dd
A
“du” command, is an abbreviation for disk usage, is used to estimate the use of file space. “du” command can be used to track files and directories that consume an excessive amount of space on the hard disk. For example:
6. Which command is used to extract a column from a text file?
A get
B paste
C cut
D tar
C
“cut” command is used to extract a vertical selection of columns from one or more files. The syntax is as follows:
$ cut -c n [file_name]
Where n is equal to the number of columns to extract. Let’s consider the content of a file named students:
$ cat students
A Emily Sara
B Bob Defrt
C Ali Syzer
D Yohan Zecdfy
The following example extracts the first column from the students file:
$ cut -c 1 students
A
D
B
D
7. Which command is used to extract the intermediate result into a pipe?
A extract
B exec
C tee
D None of the above
[st_adsense]
C
“tee” command reads the standard input and writes it to both the standard output and one or more files. The following command writes the output to both the screen (stdout) and the file my_file.
$ ls | tee my_file
8. Which command changes the group owner of a file?
A chgrp
B cgrp
C change
D group
A
“chgrp” command is used to change the group property of a file/directory. For example :
$ chgrp alex my_folder/
$ ls -l
drwxrwxr-x 2 ubuntuvm alex 4096 Jun 10 16:04 my_folder
Here we have changed the group property of the directory named “my_folder” to alex.
9. Which command is used to display the contents of a compressed text file?
A zcat
B print
C type
D cat
[st_adsense]
A
“Zcat” is a command to display the content of a compressed file without decompressing it.
$ zcat myzip.txt.gz
Hello World!
Hello World! is the text found in a text file in the archive myzip.txt.gz
10. Which command is used to display the octal value of a text file?
A oct
B octal
C text_oct
D od
D
od command in Linux is used to display the content of a file in different formats, octal is the default format.
MCQPractice competitive and technical Multiple Choice Questions and Answers (MCQs) with simple and logical explanations to prepare for tests and interviews.Read More
[st_adsense]