Sunday, July 19, 2020

Linux Interview questions with answers Part-1

Q-1. What is the shortest command to take you back to the home directory? 
A. cd ~ 
B. cd $HOME 
C. cd 
D. . 

 Answer. C 

 Q-2. Which of the following best defines the purpose of the following operator >>? 
A. Forwards the output of one command, so that it becomes the input for another. 
B. It sends both input and output to the same file. 
C. It’ll overwrite the contents of the target file. 
D. Appends data to a file without overwriting it. 

 Answer. D 

 Q-3. Which of the options specifies the system file meant for holding the processor information? 
A. /bin/cpu 
B. /dev/cpuinfo 
C. /proc/cpuinfo 
D. /etc/cpu

 Answer. C

 Q-4. Which of the commands would search for the string “Linux” at the end of the line in a file called textfile? 
A. grep ‘Linux# ‘ textfile 
B. grep ‘ Linux! ‘ textfile 
C. grep ‘ Linux$ ‘ textfile 
D. grep ‘ Linux^’ textfile

 Answer. C  

Q-5. What is the command to list the hidden files in your HOME directory?
 A. ls -hn 
B. ls -h 
C. ls -la 
D. ls -la ~/ 

 Answer. D 

 Q 6 - The following command can list out all the current active logins. 
A - whoami 
B - who am i 
C - who 
D - None of the above.

 Answer : C 

 Q 7 - Choose the correct from below to search for lines beginning with the pattern using grep. 
A - ^pattern 
B - pattern^ 
C - $pattern 
D - pattern$ 

 Answer : A 

 Q 8 - Which command can be used to start the process with the required priority?
 A - schedule 
B - nohup 
C - nice 
D - prefer 

 Answer : C 

 Q 9 - Per user configuration setting are found in the following file of user’s home directory. 
A - profile 
B - .profile 
C - .mbox 
D - .exrc 

 Answer : B 

 Q 10 - Which command is used to copy file across different system? 
A - rcp 
B - ftp 
C - mcp 
D - ncp 

 Answer : B 

 Q 11 - In general the working directory of the user root is __ 
A - / 
B - /root 
C - /admin 
D - /home/root 

 Answer : B 

 Q 12 - What does the following command will do? $ chmod 888 file 
A - It enables r,w,x premissions for all users 
B - It disable r,w,x permissions for all users 
C - It enables r,w,x permissions only for owner of the file 
D - None of the above. 

 Answer : D

No comments:

Post a Comment