This Blog is to share our knowledge and expertise on Linux System Administration and VMware Administration

Monday, September 14, 2015

Basic Linux Interview Questions and Answers - Linvirtshell

1. 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
2. What is the difference between soft link and hard link?
    Soft Link

  • Using this only a link to the original file is created (shortcut).
  • The size of created shortcut is null.
  • If you delete the file then the created link (shortcut) won't work.
  • In case you delete the shortcut link then it won't affect the original file
    Hard Link
  • Another copy of the file is created.
  • Both the file have same inode no.
  • Any changes made in either of the file will appear on the other file.
  • Deleting any of the one file won't affect the other file.
3. How to find the bit size of your Linux machine?
    # uname -m
    # getconf LONG_BIT

4. How can you add a banner or login message in Linux?
By editing these two files

    /etc/issue
    /etc/motd

5. How will you check the release version of your Linux machine?
    # cat /etc/redhat-release

6. 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

7. 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

8. Which file is generally used to configure kickstart?
    anaconda.cfg

9. What is the command use to compress a dir using gzip compression?
    # tar -czvf myfil.tar.gzip orig_file

10. What is the command use to compress a dir using bzip2 compression?
    # tar -cjvf myfil.tar.bzip2 orig_file

11. Which log file will you check for all authentication related messages?
    /var/log/secure

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

13. What is the command used to find the process responsible for a particular running file?
      # fuser -m filename
      # lsof filename

14. 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

15. How to check all the process running by a particular user?
        # ps -u username

16. What is an orphan process?
       An orphan process is a process that is still executing, but whose parent has died.

17. How to remove the package without checking the dependencies on Redhat Linux ?
      rpm -ev –nodeps package_name

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

19. How to enable SAR command to store data for more then a month?
      #/etc/sysconfig/sysstat - Here change the History = 30 days and sar will start storing the data for months.

20. What is ACL?

    #Requiremnet to use ACL - A file system should be mounted with ACL option.
    #ACL allows us to give permssion to someone without change the actual permission of   the file.
    # setfacl -m file:rwx -u User

21. How to allow specfic user to login via SSH?
    #AllowUsers anze dasa kimy in /etc/sshd/ssh.conf

22. how to create a new partition and add to swap?
    #create new parttion with fdisk and mark the partition type as 83
    #mkswap /dev/sdaX
    #swapon /dev/sdaX

23. How to get the list of dependencies for specific rpm file ?
    rpm -qpR rpm_file

24. How to get the list of dependencies for specific package ?
    rpm -qR package_name

No comments:

Post a Comment