MCQ

Linux MCQs – LINUX commands – Part 4

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.
 

1. Which command will you use to display the routes of an available network?

A route status

B netstat -r

C show route

D None of the above

B
NETSTAT command allows to display the network configuration and status on a local TCP/IP stack.

 

 
 

2. Which screen manipulation command resets the screen to the normal state?

A tput rmso

B tput smso

C tput cup

D tput blink

A
tput is a command to manipulate our terminal. With it you can change the color of the text, apply effects and generally brighten things up. For example, to see how many colors are supported, use the following command :

$ tput colors

 
For example, to move the cursor to the position 30 characters to the right and 8 lines down:

$ tput cup 8 30

 

 

3. Which command to display the date in the following format “dd/mm/yyyy”?

A date + %d/%m/%Y

B date + ”%d/%m/%Y”

C date + /%d/%m/20%y

D date + ”/%d/%m/20%y”

A
$ date + %d/%m/%Y

Display the date in DD/MM/YYYY format

 

 

4. Which command to display the file ‘test.txt’ ?

A man test.txt > more

B cat test.txt < more

C cat test.txt | more

D None of the above

C
The “cat” command is very frequently used in Linux. It reads the data from the file and gives their content as output. The command “more” is used to page the results of another command in this case it is “cut”.

 

 
 

5. Which command displays the name of the operating system?

A uname -n

B uname -r

C uname -o

D uname –m

C
$ uname -o

This command allows you to display the name of the operating system

 

 

6. How to add the file “file1” in the compressed file “example.tar”?

A We can’t add the file1 in example.tar

B tar -cvf example.tar file1

C tar -rvf file1 example.tar

D tar -evf file1 example.tar

C
$ tar -rvf file1 example.tar

This command add the file “file1” in “example.tar”.

 

 

7. How to run ls command in vi editor ?

A :ls

B :!ls

C !ls

D We can’t execute it

B
$ :!ls

This command allows to execute the ls command in the vi editor.

 

 

8. Which command gives the first byte or the difference between the two files?

A diff

B cmp

C comm

D ls -a
 

 
B
“cmp” command is used to compare two files byte by byte and helps you determine if the two files are identical or not. For example:

$ cmp file1.txt file2.txt

 

 

9. To open the file “file1” with the cursor on line number 4 we use the following command $______ ?

A vi +/se 4 file1

B vi +4 file1

C vi +set 4 file1

D vi + “set 4” file1

B
$ vi +4 file1

This command allows to open the file “file1” with the cursor on the line number 4.

 

 

10. “sed” is a command generally used to _________ ?

A Perform complex calculations

B Modify / print the selective content of a file

C Perform non-blocking I/O based on FIFO

D None of the above

C
sed command is a non-interactive text editor.

 

 
mcqMCQPractice competitive and technical Multiple Choice Questions and Answers (MCQs) with simple and logical explanations to prepare for tests and interviews.Read More

Leave a Reply

Your email address will not be published. Required fields are marked *