Monday, December 15, 2014

Basic and important interview question for linux

Basic Interview Question Answer For Linux:


1. What are the steps involved to create the logical volume from scratch ?
 Ø  Create a physical volume using pvcreate command.
                         #pvcreate /dev/sda
 Ø  Create a volume group using “vgcreate” command 
                          #vgcreate vg1 /dev/sda
 Ø  Create a logical volume using “lvcreate” command
                          #lvcreate -L 100M -n vol1 vg1
 Ø  Create a filesystem on logical volume using mkfs command.
                          #mkfs -t ext4 /dev/vg1/vol1
 Ø  Mount the filesystem using mount command for use.
                           #mount -t ext4 /dev/vg1/vol1 /vol1

  2.     File which stores the DNS configuration at client side
               /etc/resolve.conf
  3.    What are the Linux boot files?
 Ø  /boot/grub/grub.conf           :  contains boot disk parameters
 Ø   /etc/fstab             :       contains File systems which need to mount at boot time
 Ø  /etc/initab             :        Contains default run level
 Ø  /etc/init.d/rc.d/rcN.d              :       This is a dir it contains

  4.    How to check the installed software(rpm’s) on Redhat Linux ?
                                #rpm -qa package_name               (or) 
                              #rpm -qa |grep package_name*




5.    Difference between swap partition and swap file?
       Swap partition is maintained as a separate partition. Same swap partition can be used for two OS within single machine.
Suppose if the system crashes, there is a chance to recover or it may not  corrupt the partition. Less  fragmented.Where as  swap file takes very less space. We can increase the space very easily, compared to swap partition. Swap file system fragmented.If  the system crashes then there is a huge chance to lost the swap file system.
     6.    How to extent the volume group ? 
Using “vgextend” we can increase the volume group.

7. How many volume groups can be created in Linux ?
 256 

8. How to install  specific software package using rpm command on Redhat Linux ?
                # rpm –ivh package_name 



9. How to remove the software package from on Redhat  Linux ?
                 #rpm -ev package_name


10.How to upgrade the existing Redhat package using rpm command ?
                #rpm -Uvh package_name


11.How to display the list of installed software package’s files ?
               # rpm -ql package_name 

14. What is lvmdump ? 
“lvmdump” is tool for LVM2 to collect the various information for diagnostic purposes.By default, it creates a tarball suitable for submission along with a problem report. Main configuration file and command used for exporting NFS directories and it’s deamons. 
/etc/exports and exportfs -av , deamons are quotad, portmapper, mountd, nfsd and nlockmgr/status.


12. How can we change speed and make full duplex settings for eth0
We can do this with below given 2 methods:
                    #ethtool -s eth0 speed 100 duplex full
                     #ethtool -s eth0 speed 10 duplex half
OR
                   #mii-tool -F 100baseTx-HD
                    #mii-tool -F 10baseT-HD

13.How to re-create the device files for LVM volumes ?
Run “vgmknodes” to recreate the LVM devices files.

15. What is command to check ports running/used over local machine?
                                          #netstat -antp
16. What is the command to check open ports at remote machine?
                                        #nmap
17. What is the difference between soft and hard links?
Soft Links:
Ø  Soft link files will have different inode numbers then source file
Ø   If original file deleted then soft link file be of no use
Ø   Soft links are not updated
Ø  Can create links between directories
Ø   Can cross file system boundaries
Hard Links:
Ø  Hard links will have the same inode number as source file
Ø   Hard links can not link directories
Ø   Can not cross file system boundaries
Ø   Hard links always refers to the source, even if moved or removed
18. How to setup never expired user password ?
                       #chage -E never username
19. Restricting insertion into file if full permission are assigned to all .
                       #chattr +i filename
20. How to decommission/remove  LVM completely from the host ?
Ø  Un-mount all the logical filesystems         
Ø  Remove the logical volumes using “lvremove” command
Ø   Destroy the volume group using “vgremove”  command.
Ø  Use “pvremove” command remove the physical volumes from the system.
21. What vmstat show
vmstat (virtual memory statistics) is a computer system monitoring tool that collects and displays summary information about operating system memory, processes, interrupts, paging and block I/O

No comments:

Post a Comment