Linux Interview General Questions with Answers

Explain in detail the Linux booting procedure

  • When a Linux machine is powered on BIOS loads up first. It will prompt you to select boot device which can be Hard disk, CD-ROM, Floppy drive, Network etc. By default generally it will boot with hard disk
  • Next comes your MBR. This will load and execute the GRUB boot loader menu. GRUB stands for Grand Unified Boot Loader. This will display the a splash screen with the contents of /boot/grub/grub.conf
  • List of available and installed kernels will be shown, if not selected default kernel will be loaded
  • Kernel: Mounts the root files system as specified by “root=” parameter inside /boot/grub/grub.conf file
  • Next it will execute /sbin/init program which will boot the linux machine in the default run level as specified by /etc/inittab
  • Runlevel: All the scripts loaded inside the selected runlevel from step 5 will be executed These scripts are placed inside /etc/rc.d/rcx.d/. Here x is the runlevel value which will be varying from 0-6
  • Scripts starting from S would load at startup and those starting with K would kill the process at shutdown. These incident will take place as per the numerical value assigned to them. For eg: s13network will load prior than s15 sendmail
  • Next your login screen will come up

To know about Linux Boot process in more detail follow the below link
Step by Step Linux Boot Process Explained In Detail

How many commands do you know which can be used to view the contents of any file?

  • less
  • more
  • tail
  • head
  • vi or vim
  • cat
For more information on the usage of above commands follow the below link

What is the difference between soft link and hard link?
Soft Link
  1. Using this only a link to the original file is created (shortcut).
  2. The size of created shortcut is null.
  3. If you delete the file then the created link (shortcut) won’t work.
  4. In case you delete the shortcut link then it won’t affect the original file
Hard Link
  1. Another copy of the file is created.
  2. Both the file have same inode no.
  3. Any changes made in either of the file will appear on the other file.
  4. Deleting any of the one file won’t affect the other file.

How to find the bit size of your linux machine?

# uname -m
i686

# uname -m
x86_64
If you get i386i586 and i686 in your reply than that signifies your machine is 32-bit but if you get x86_64 or ia64 then your machine will be 64-bit.
# getconf LONG_BIT
32

# getconf LONG_BIT
64Here you will get an output of bit size either 32 or 64.

How can you add a banner or login message in Linux?
By editing these two files
/etc/issue
/etc/motd

For more details follow below link
Add a Banner to your Linux machine

How will you check the release version of your Linux machine?
# cat /etc/redhat-release
What is the difference between normal kernel and kernel-PAE?
kernel in 32 bit machine supports max of 4 GB RAM whereas

kernel PAE in 32 bit linux machine supports till 64 GB RAM

Tell me the command to find all the commands in your linux machine having only 2 words like ls, cp, cd etc.
# find /bin /sbin/usr/bin /usr/sbin -name ?? -type f
Which file is generally used to configure kickstart?
anaconda.cfg

What is the command use to compress a dir using gzip compression?
# tar -czvf myfil.tar.gzip orig_file
What is the command use to compress a dir using bzip2 compression?
# tar -cjvf myfil.tar.bzip2 orig_file
Which log file will you check for all authentication related messages?
/var/log/secure

What is the command to create multiple directories using one command?
Using -p argument along with mkdir command

Which command would you prefer to monitor your system performance and why?
I personally prefer top and sar command to view the performance related factors of my Linux machine.

The top program provides a dynamic real-time view of a running system. It can display system summary information as well as a list of tasks currently being managed by the Linux kernel.

Also sar gives us a standard o/p of the running activity performance related factors in relation to paging, NIC, CPU, Memory etc

For more information on top and sar command follow the below links

Tutorial for Monitoring Tools SAR and KSAR with examples in Linux

What is the command used to find the process responsible for a particular running file?
# fuser filename
# lsof filename
What is the command to take remote of any Linux machine?
# rdekstop
What are the three values shown in load average section of top command?
It shows the current, 5 min back and 15 min back load average value

How to check all the process running by a particular user?
# ps -u username
What is an orphan process?
An orphan process is a process that is still executing, but whose parent has died.

What is a defunct process?
These are also termed as zombie process. These are those process who have completed their execution but still has an entry in the process table. When a process ends, all of the memory and resources associated with it are de-allocated so they can be used by other processes.After the zombie is removed, its process identifier (PID) and entry in the process table can then be reused.

Zombies can be identified in the output from the Unix ps command by the presence of a “Z” in the “STAT” column

What is the command in sar to monitor NIC devices received/transmitted packets?
# sar -n DEV 1 5 

This will show 5 consecutive output each with a time interval of 1 sec for all the ethernet devices

To learn more about SAR command follow the below link
Tutorial for Monitoring Tools SAR and KSAR with examples in Linux

5 thoughts on “Linux Interview General Questions with Answers”

Leave a Comment