Linux practice questions
If you're configuring the GRUB boot loader, which of the following files would you edit in a boot loader?
ANS: /boot/grub2/grub.cfg
Which command will allow you to change the priority of a program already running?
ANS: renice
Which command substitutes every instance of a word Windows to Linux in a file named ops?
ANS: sed 's/windows/linux/g' ops
Which key is used to undo in vi editor.
ANS: u
How to delete all empty lines from data.txt file and save?
Ans: sed -i '/^/$/d' data.txt
What is the meaning of chmod 777?
In the terminal, the command to use to change file permission is " chmod ". In short, "chmod 777" means making the file readable, writable and executable by everyone.
Which of the following commands cannot reboot the system?
Telinit 0 init 0 : Shutdown (goes thru the /etc/rc0.d/* scripts then halts) init 1 : Single user mode or emergency mode means no network no multitasking is present in this mode only root has access in this runlevel init 2 : No network but multitasking support is present . init 3 : Network is present multitasking is present but with out GUI . init 4 : It is similar to runlevel 3; It is reserved for other purposes in research. init 5 : Network is present multitasking and GUI is present with sound etc. init 6 : This runlevel is defined to system restart.
Which of the following commands will display all the files in your current directory and its subdirectories including the hidden files?
ls -aR
Which of the following commands displays one page of output at a time?
more
Which command will tar files p1 p2 and p3 into filename.tar?
tar cvf filename.tar p1 p2 p3
Which key is used to undo in vi editor.
u
Which of the following commands can be used to change default permissions for files and directories at the time of creation?
unmask
What is the command to count the number of words in a file?
wc