Linux Quiz MCQs for interview preparation


Which command is used to list files and directories?


a) ls

b) list

c) dir

d) show


----------------------------------------------------------------------

Which command is used to display the contents of a file?


a) display

b) show

c) cat

d) view


-------------------------------------------------

Which command is used to change the current directory?


a) cd

b) chdir

c) change

d) dir



---------------------------------------------------------------------------



What is the purpose of the 'chmod' command?


a) Change directory

b) Change file permissions

c) Change file owner

d) Change file group

----------------------------------------------------------------------------------------------------------



Which command is used to view the manual page of a command?


a) man

b) help

c) info

d) doc


--------------------------------------------------------------------------------------------------




Which of the following is a text editor in Linux?


a) vim

b) notepad

c) wordpad

d) writer



=====================================================================================================================


Which command is used to search for a pattern in a file?


a) find

b) grep

c) search

d) locate




========================================================================================================




What does 'pwd' stand for?


a) Present Working Directory

b) Print Working Directory

c) Previous Working Directory

d) Primary Working Directory


-----------------------------------------------------------------------------------



What is the default shell in most Linux distributions?


a) zsh

b) fish

c) bash

d) tcsh


------------------------------------------------------------------

Which command is used to remove a file?


a) rm

b) del

c) erase

d) remove

-------------------------------------------------------------------------------


Which command is used to display the current date and time?


a) time

b) date

c) datetime

d) clock

-----------------------------------------------------------------------------------



Which command is used to display the disk usage of a directory?


a) du

b) df

c) disk

d) space


------------------------------------------------------------------------------------

Which command is used to display the current running processes?


a) jobs

b) ps

c) top

d) list

--------------------------------------------------------------------------------


What does 'sudo' stand for?


a) Super User Do

b) Substitute User Do

c) Switch User Do

d) Secure User Do


======================================================================================


Which file contains the list of users on a Linux system?


a) /etc/group

b) /etc/shadow

c) /etc/passwd

d) /etc/users


----------------------------------------------------------------------------------------------


Which command is used to create a new directory?


a) mkdir

b) createdir

c) makedir

d) newdir


-------------------------------------------------------------------------------------


Which command is used to copy files?


a) cp

b) copy

c) mv

d) duplicate


--------------------------------------------------------------------------------------------------




Which command is used to move files?


a) mv

b) move

c) cp

d) shift


------------------------------------------------------------

What is the file descriptor for standard input?


a) 0

b) 1

c) 2

d) 3

--------------------------------------------------------------------------


Which command is used to change file ownership?


a) chown

b) chgrp

c) chmod

d) chfile


---------------------------------------------------------------------------


Which command is used to compress files?


a) tar

b) zip

c) compress

d) gzip


--------------------------------------------------------------------------------

Which command is used to extract files from a tar archive?


a) untar

b) tar -xvf

c) unarchive

d) unzip


-----------------------------------------------------------------------------------

Which command is used to check disk space usage?


a) du

b) df

c) disk

d) space

-----------------------------------------------------------------------------------------------


Which file contains the system's hostname?


a) /etc/hostname

b) /etc/hosts

c) /etc/sysconfig/network

d) /etc/netname

----------------------------------------------


What is the shebang line in a script?


a) #! /bin/bash

b) #! /usr/bin/bash

c) #! /bin/sh

d) #! /usr/bin/sh


-----------------------------------------

Which command is used to display the first few lines of a file?


a) head

b) top

c) start

d) init


----------------------------------------------------------------------------


Which command is used to display the last few lines of a file?


a) tail

b) bottom

c) end

d) finish

-----------------------------------------------------------------------------------


Which command is used to schedule tasks to run at specific intervals?


a) cron

b) at

c) schedule

d) task


----------------------------------------------------------------------------------


Which command is used to display network interfaces?


a) ifconfig

b) netconfig

c) ipconfig

d) interfaces


---------------------------------------------------------------------------------

Which command is used to find files in a directory hierarchy?


a) find

b) search

c) locate

d) query


---------------------------------------------------------------------


Which file contains user passwords in a hashed format?


a) /etc/shadow

b) /etc/passwd

c) /etc/security

d) /etc/secure


=========================================================================


Which command is used to view the contents of a directory in a tree-like format?


a) tree

b) list

c) dir

d) show

-------------------------------------------------------------------'


What is the command to display the kernel version?


a) uname -r

b) uname -a

c) uname -v

d) uname -k

=====================================================================

Which command is used to change the priority of a process?


a) nice

b) renice

c) priority

d) change


----------------------------------------------------------------------------


Which command is used to view the amount of free and used memory in the system?


a) free

b) mem

c) memory

d) usage


----------------------------------------------------------

Which command is used to display a calendar?


a) cal

b) calendar

c) date

d) time

-----------------------------------------------------------------


What does the 'grep' command stand for?


a) Global Regular Expression Print

b) Global Regex Expression Print

c) General Regular Expression Print

d) General Regex Expression Print

------------------------------------------------------------------



Which command is used to shut down the system?


a) shutdown

b) poweroff

c) halt

d) All of the above


------------------------------------------------------------


Which command is used to change the group ownership of a file?


a) chgrp

b) chown

c) chmod

d) chfile

-----------------------------------------------



Which command is used to view the contents of a binary file?


a) od

b) hexdump

c) strings

d) All of the above


---------------------------------------------------------------



Which file is used to configure network interfaces?


a) /etc/network/interfaces

b) /etc/sysconfig/network-scripts/ifcfg-*

c) /etc/network/config

d) Both a and b


 ------------------------------------------------------------------

 

Which command is used to kill a process?


a) kill

b) terminate

c) end

d) stop


--------------------------------------------------------------------



Which command is used to send a signal to a process?


a) kill

b) signal

c) notify

d) send


--------------------------------------------------------------------

What does 'SSH' stand for?


a) Secure Shell

b) Secure Socket

c) Secure System

d) Secure Service


-----------------------------------------------------------


Which command is used to create a symbolic link?


a) ln -s

b) link -s

c) symlink

d) slink



-------------------------------------------------------------

Which command is used to view the current user's home directory?


a) echo $HOME

b) echo $USER

c) echo $DIR

d) echo $PWD


--------------------------------------------------------------------------------



Which file contains system-wide environment variables?


a) /etc/environment

b) /etc/profile

c) /etc/bashrc

d) /etc/env


------------------------------------------------------------------

Which command is used to view the routing table?


a) route

b) netstat -r

c) ip route

d) All of the above



-============================================================================


Which command is used to display the size of a file or directory?


a) du

b) df

c) ls -lh

d) size

--------------------------------------------------------------------------------




Which command is used to display the username of the current user?


a) whoami

b) who

c) id

d) user


=========================================

Shell Scripting


Which symbol is used to denote a comment in a shell script?


a) #

b) //

c) ;

d) ::

----------------------------------------------------------------


How do you make a shell script executable?


a) chmod +r script.sh

b) chmod +w script.sh

c) chmod +x script.sh

d) chmod +e script.sh

---------------------------------------------------------------------------------

What does the #!/bin/bash line at the beginning of a shell script signify?


a) It is a comment

b) It specifies the script interpreter

c) It is the script title

d) It specifies the script author

----------------------------------------------------------------------------------


Which command is used to print text to the screen in a shell script?


a) print

b) display

c) echo

d) type

---------------------------------------------------------------------------------------



How do you capture the output of a command into a variable in a shell script?


a) var=$(command)

b) var=command

c) var="command"

d) var[command]



---------------------------------------------------------------------------------


Advanced Commands and Their Options


Which command is used to search for a string in a file?


a) find

b) grep

c) search

d) locate

----------------------------------------------------------------------

What does the -r option in the cp command do?


a) Copies files recursively

b) Removes files after copying

c) Renames files during copy

d) Restarts the copy process


------------------------------------------------------------------------


Which command is used to display disk usage in a human-readable format?


a) du -h

b) df -h

c) ls -h

d) free -h


------------------------------------------------------


What is the purpose of the nohup command?


a) To execute a command without hanging up

b) To execute a command in the background

c) To execute a command with high priority

d) To execute a command with low priority

------------------------------------------------------------

Anic_an_engineer

Hi, I am Anic an IT Professional . I like to share my knowledge and experience. Thanks for visiting my site.

Please Select Embedded Mode To Show The Comment System.*

Previous Post Next Post