Interview Questions for Linux
INTERVIEW QUESTIONS FOR LINUX WITH ANSWERS
Explain the booting process in linux
•The system BIOS checks the system and launches the first stage boot loader on the MBR of the
primary hard disk.
•The Frist stage boot loader loads itself into memory and launches the second stage boot loader from
the /boot/ partition.
•The second stage boot loader loads the kernel into memory, which in turn loads any necessary
modules andmounts the root partition read-only.
•The kernel transfers control of the boot process to the /sbin/init program.
•The /sbin/init program loads all services and user-space tools, and mounts all partitions listed in
•The user is presented with a login screen for the freshly booted Linux system.
1 . What command is used to list the hidden contents of directory?
2. What command is used to display a list of currently running processes
ps , top , pstree
3. What are the common run levels in linux
1.Single user mode
2.Mutliuser without NFS Command line only
3.Multiuser with NFS Command line only
5.Default GUI –x11
4. Which command is used to check the number of files and disk space used and the each user’s defined quota?
5. Which utility is used to make automate rotation of a log?
6. How environment variable is set so that the file permission can be automatically set to the newly created files?
7. You need to see the last fifteen lines of the files dog, cat and horse. What command should you use?
tail -15 dog cat horse
8. The use of Zcat commands
The zcat utility allows you to examine the contents of a compressed file much the same way that cat displays a file.
9.When you issue the command ls -l, the first character of the resulting display represents the file’s ___________. type
The first character of the permission block designates the type of file that is being displayed
10 . You wish to restore the file memo.ben which was backed up in the tarfile MyBackup.tar. What command should you type?
tar -xf MyBackup.tar memo.ben
11. What daemon is responsible for tracking events on your system?
12. What command is used to remove the password assigned to a group?
13 . what are the seven fields in the /etc/passwd file
username, UID, GID, comment, home directory, command
14 . Which file defines all users on your system?
15. Which partitioning tool is available in all distributions?
16. What utility can you use to automate rotation of logs?
17. what is inode ?
All UNIX files have its description stored in a structure called ‘inode’. The inode contains info about the file-size, its location, time of last access, time of last modification, permission and so on.
18. Which file in linux stores services and respective port numbers ?
19.Command to list all the links from a directory?
20. Create a read-only file in your home directory?
chmod 400 file
21. How will you find which operating system your system is running on in UNIX?
22. . How will you run a process in background?
For running a process in background use “&” in command line
23. How will you bring a background into foreground ?
For bringing it back in foreground use command “fg jobid”
24. how will you kill a process?
kill -9 PID
25. How do you see command line history in UNIX?
history command along with grep command
26 . How do you know if a remote host is alive or not?
You can check these by using either ping or telnet command in UNIX
27. How do you copy file from one host to other?
Scp , rsync and sftp
28. How do you find which process is taking how much CPU?
29. How do you check how much space left in current drive ?
30 . How do you find how many cpu are in your system and there details?
By looking into file /etc/cpuinfo for example you can use below command:
cat /proc/cpuinfo or by command #lscpu
31. List all the files and directories in the box which holds the 777 permission in Unix?
find . -perm 777 –print
32 . In a file word UNIX is appearing many times? How will you count number?
grep -c “Unix” filename
33. How to find network configuration in linux ?
34. How to find Network connections, routing tables, interface statistics ?
35. Which command is used to view user information
36 . How do you find whether your system is 32 bit or 64 bit ?
Either by using “uname -a” command or by using “arch” command
37. How do you find for how many days your Server is up?
By using uptime command in UNIX
38. How do you find which processes are using a particular file?
By using lsof command in UNIX. It wills list down PID of all the process which is using a particular file.
39. You have an IP address in your network how will you find hostname and vice versa?
By using nslookup command in UNIX,
40 . How do you find out what’s your shell?
41. What file should you examine to determine the defined runlevels for your system?
42. Which file contains the information of all mount points
43 . Logs and their paths
/var/log/messages system log messages can be seen here
/var/log/dmesg Kernel boot log messages can view
There are Three centralized login demons
klogd:- collect log file created by the Kernel
syslogd:- Collect log file created by the system
auditd:- Collect log file created by the SELinux
After collecting the log system store logs on different location
/var/log/dmesg:- Created at boot time, by kernel
/var/log/messages:- standard system error message,
/var/log/secure:- authentication related log
/var/log/maillog:- Mail related log
/var/log/audit/audit.log:-Selinux related log
We can redirect the log by configuring
44 . How do you check the sizes of all users home directories (one command)?
45 . Command to find list of all packages
46 . In order to display the last five commands you have entered using the history command, you would type
47. Command to display FQDN name ?
hostname –f displays the fully qualified host and domain name
48 . What is the use of dig command
Domain Information Groper (dig) is a network administration command-line tool for querying Domain Name System (DNS) name servers for any desired DNS records.
49. What is LILO?
LILO is Linux Loader is a boot loader for Linux. It is used to load Linux into the memory and start the Operating system
50. what is GRUB ?
GNU GRUB (short for GNU GRand Unified Bootloader) is a boot loader package from the GNU Project. GRUB is the reference implementation of the Multiboot Specification, which provides a user the choice to boot one of multiple operating systems installed on a computer or select a specific kernel configuration available on a particular operating system’s partitions.