We’ve compiled a list of the top thirty Linux interview questions that surfaced in the written tests conducted by all big IT companies in the last six months. Almost 70% of the candidates who appeared in those tests had less than one year of experience. While 25% of them were in the range of 1 to 2 years and the remaining 5% were freshers.
Introduction
Linux is an OS that every IT engineer should learn, especially those who are in their last semester or have recently passed out. It can let them have an edge in interviews as well as in their work environment. For example, if they get an opportunity to work on Android, then their Linux skills would help in learning it faster. Also, if they are going to be a Mac OS X developer, then they’ll benefit from learning Linux.
Below are two of the most popular posts on our blog which have served as an excellent learning resource for Unix/Linux geeks. You might like to watch them out as well.
The famous Linux inherits its name from Linus Torvalds, the man behind its creation. It’s the most versatile operating system available to date. It powers millions of websites and protects their digital resources. It comes in various forms, but the core remains the same. So once you master it by practicing on one of the basic versions, the same knowledge you can apply on any of its advanced or customized versions.
Now, you can begin reading the Linux interview questions/answers given in the below section. All of these are related to OS/commands and would measure the scale of your knowledge.
Top 30 Linux Interview Questions and Answers for Beginners
Q-1. During the Linux boot process, what happens immediately after the phase called “load kernel”?
A. Load initial ramdisk
B. Run init
C. Mount root filesystem
D. Load modules
Q-2. What is the correct command to copy an entire directory structure? Say from Project
to Project.backup
.
A. cp -r Project Project.backup
B. cp -e Project Project.backup
C. cp -d Project Project.backup
D. cp -s Project Project.backup
Q-3. Which of the following commands would successfully create a crontab entry?
A. crontab -c
B. crontab -e
C. crontab -make
D. crontab –create
Q-4. Which of the following commands would delete a crontab entry?
A. crontab -d
B. crontab -e
C. crontab -r
D. del -crontab
Q-5. Where does Linux store the commands executed recently?
A. .bashrc_history
B. .history
C. .bash_history
D. .bash_list_history
Q-6. What symbol represents that ACLs have been set on a file?
A. <
B. +
C. ~
D. >
Q-7. Which of the following numbers represents the SIGSTOP signal?
A. 1
B. 19
C. 9
D. 18
Q-8. What is the correct octal value for the permission string nvxr-xr--
?
A. 754
B. 724
C. 624
D. 742
Q-9. What is the command to unmount a filesystem?
A. dmount
B. dismount
C. unmount
D. umount
Q-10. How would you continuously display memory usage every 5 seconds?
A. free -s 5
B. top -m 5
C. du -m 5
D. mem -c 5
Also Read: 7 Linux Commands for Programmers
Q-11. What is the best possible way to direct the shell for running a command in the background?
A. Put an & symbol at the end of the command line.
B. Run the command after placing it inside a script.
C. Press Ctrl+c after you have keyed in the command.
D. Press Ctrl+d after you have keyed in the command.
Q-12. Which of the following run-levels permits full multiuser mode without any graphical login manager?
A. Runlevel 2
B. Runlevel 0
C. Runlevel 3
D. Runlevel 1
Q-13. What difference does the expression 2>&1 make to the result of the below command?
$ find / -name test.txt > names 2>&1
A. Send the standard error to a file called &1
B. Append the standard error to a file called &1
C. Send the output of the find command to /dev/null
D. Send the standard error to the same place as the output.
Q-14. What is the command that displays the settings for all services and run levels?
A. services --runlevels
B. chkconfig --list
C. runlevel --settings
D. status --l
Q-15. Which of the following can’t work as a mount option in /etc/fstab
?
A. rw
B. noexec
C. ndev
D. defaults
Q-16. How will you check if the two files are hard-linked to each other?
A. hl -l
B. ln -s
C. ls -i
D. link -s
Q-17. Which of the following outlines the correct path for the grub’s configuration file?
A. /boot/grub/lsof.conf
B. /etc/grub/grub.txt
C. /etc/grub/grub.conf
D. /boot/grub/menu.lst
Q-18. What is the command to print the crontab entries for the logged-in user?
A. crontab -display
B. crontab -d
C. list –crontab
D. crontab -l
Q-19. Which of the following commands would ask for confirmation before deleting files?
A. rm -a
B. rm -i
C. rm -chk
D. rm -r
Q-20. From the following options, which one would run the ls command after printing the current date?
A. date $ ls -l
B. date; ls -l
C. date – ls -l
D. date > ls -l
Must Read: Linux Commands Cheat Sheet
Q-21. Which of the following can be used to set the immutable attribute on a file?
A. chmod +i
B. immut +a
C. chattr +i
D. attrib +i
Q-22. What is the command to start a job that will keep on running even after closing the session?
A. hup command
B. nohup command
C. jobc command
D. hup.out command
Q-23. What is the shortest command to take you back to the home directory?
A. cd ~
B. cd $HOME
C. cd
D. None of these.
Q-24. 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.
Q-25. 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
Q-26. Which of the options specifies the directory where SUSE Linux stores the crontab files for all users?
A. /var/spool/cron/tabs
B. /usr/lib/cron
C. /usr/bin/cron/crontabs
D. /var/spool/cron/users/tabs
Q-27. What is the correct option that provides the command to sort a file named textfile in column 5?
A. sort -n 5 textfile
B. sort -k 5 textfile
C. sort -c 5 textfile
D. sort -c5 textfile
Q-28. 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
Q-29. 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 ~/
Q-30. Which of the following commands should you use to check if the Cron daemon is running?
A. service –status-all
B. ps -list –daemons
C. daemons –list –all
D. cron –status
Summary – 30 Linux Interview Questions
We are hopeful that the above Linux interview questions and answers will help you immensely. And you’ll do well in your upcoming interviews.
It would be great if you let us know your feedback on this post. Also, you can ask us to write on a topic of your choice. We’ll add it to our writing roadmap.
Lastly, if you enjoyed the post, then please care to share it with friends and on social media.
More Linux Questions and Answers for Freshers
Keep Learning,
TechBeamers