Linux Interview Questions - Part 6





1.What are Daemons ??

Daemons are services that provide several functions that may not be available under the base operating system. 
Its main task is to listen for service request and at the same time to act on these requests. After the service is done, 
it is then disconnected and waits for further requests.

2.What are environmental variables?

Environmental variables are global settings that control the shell’s function as well as that of other Linux programs. 
Another common term for environmental variables is global shell variables

3.What are the different modes when using vi editor?

There are 3 modes under vi:
- Command mode – this is the mode where you start in
- Edit mode – this is the mode that allows you to do text editing
- Ex mode – this is the mode wherein you interact with vi with instructions to process a file

4.How can we change speed and make full duplex settings for eth0

Ans 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


5.What are the process states in Unix?

As a process executes it changes state according to its circumstances. Unix processes have the following states:

Running : The process is either running or it is ready to run .
Waiting : The process is waiting for an event or for a resource.
Stopped : The process has been stopped, usually by receiving a signal.
Zombie : The process is dead but have not been removed from the process table.


6.Explain /proc filesystem?

/proc is a virtual filesystem that provides detailed information about Linux kernel, hardware’s and running processes. Files under /proc directory named as Virtual files. 
Because /proc contains virtual files that’s why it is called virtual file system. These virtual files have unique qualities. 

Most of them are listed as zero bytes in size. Virtual files such as /proc/interrupts, /proc/meminfo, /proc/mounts, and /proc/partitions provide an up-to-the-moment glimpse of the system's hardware. Others, like the /proc/filesystems file and the /proc/sys/ directory provide system configuration information and interfaces.


7.What is the difference between hardware RAID and Software RAID?

The hardware-based RAID is independent from the host. A Hardware RAID device connects to the SCSI controller and presents the RAID arrays as a single SCSI drive. 

An external RAID system moves all RAID handling "intelligence" into a controller located in the external disk subsystem. The whole subsystem is connected to the host via a normal SCSI controller and appears to the host as a single disk.

Software RAID is implemented under OS Kernel level. The Linux kernel contains an MD driver that allows the RAID solution to be completely hardware independent.

 The performance of a software-based array depends on the server CPU performance and load.

8.What is the difference between cron and anacron

Ans  Cron :
                     1) Minimum granularity is minute (i.e Jobs can be scheduled to be executed
                         every minute)
                     2) Cron job can be scheduled by any normal user ( if not restricted by super
                          user )
                     3) Cron expects system to be running 24 x 7. If a job is scheduled, and
                         system is down during that time, job is not executed
                     4) Ideal for servers
                     5) Use cron when a job has to be executed at a particular hour and minute

      Anacron :
                     1) Minimum granularity is only in days
                     2) Anacron can be used only by super user ( but there are workarounds to
                         make it usable by normal user )
                     3) Anacron doesn’t expect system to be running 24 x 7. If a job is scheduled,
                         and system is down during that time, it start the jobs when the system
                         comes back up.
                     4) Ideal for desktops and laptops
                     5) Use anacron when a job has to be executed irrespective of hour and
                          minute


9.What is CUPS?

CUPS stands for "Common UNIX Printing System". CUPS is a open source printing system developed by Apple Inc. CUPS uses the Internet Printing Protocol (IPP) to allow local printing and print sharing.
The log files for the CUPS printing system are located in the /var/log/cups/ directory.

10.How Many Run Levels present in Linux?

There are 7 run levels, with each having its own properties.
- 0: Halt the system
- 1: Single-user mode 
- 2: Not used
- 3: Multi-user mode with text login
- 4: Not used
- 5: Multi-user mode with graphical login
- 6: Reboot



YUM :Yellowdog Updater Modified : An Overview



YUM : Yellowdog Updater Modified 


  • YUM (Yellowdog Updater Modified) is an open source command-line as well as graphical based package management tool 
  • It was developed and released by Seth Vidal under GPL (General Public License) as an open source
  • YUM uses numerous third party repositories to install packages automatically by resolving their dependencies issues.



1.How to install Package using YUM?

#yum install firefox


If you want to install packages automatically without asking any confirmation, use option -y 

#yum -y install packagename

2.How to remove package using YUM ?

#yum remove packagename


To disable confirmation prompt just add option -y as shown in below.

#yum -y remove package 


3.How to update package using YUM?

#yum update packagename


4.List package using YUM ?

#yum list packagename


List all available package ?

# yum list | less

List all installed package ?

#yum list installed | less


5.Search a package using YUM ?

#yum search packagename

6.Find a file belongs to which package using YUM?? PROVIDES Function ?

#yum provides /etc/httpd/conf/httpd.conf


7.How to check available update ?

#yum check-update


8.List available Group packages?

#yum grouplist

9.How to install GROUP of packages?

#yum groupinstall "groupname"


10.How to remove group of package?

#yum groupremove "group name"


11.How to list enabled REPO ?

# yum repolist

12.How to list all enabled / disabled Repo list?

#yum repolist all


13.How to install a package from specific repository?

# yum --enablerepo=repo_name install packagename

14. How to clean YUM cache?

#yum clean all


15. View YUM history?

 #yum history




RPM - RedHat Package Manager - An Overview



RedHat Package Manager ( RPM )

RPM (Red Hat Package Manager) is an default open source and most popular package management utility for Red Hat based systems like (RHEL, CentOS and Fedora). 
The tool allows system administrators and users to install, update, uninstall, query, verify and manage system software packages in Unix/Linux operating systems. 





Facts About RPM

RPM is free and released under GPL (General Public License).
RPM keeps the information of all the installed packages under /var/lib/rpm database file.
RPM is the way to install packages under Linux systems, if you’ve installed packages using source code, then rpm won’t manage it.
RPM deals with .rpm files, which contains the actual information about the packages such as: what it is, from where it comes, dependencies info, version info etc.

Five Basic Modes of RPM 


1.Install : It is used to install any RPM package.
2.Remove : It is used to erase, remove or un-install any RPM package.
3.Upgrade : It is used to update the existing RPM package.
4.Verify : It is used to query about different RPM packages.
5.Query : It is used for the verification of any RPM package.

RPM Download links:

To find a rpm package and download use the below links
http://rpmfind.net
http://www.redhat.com
http://freshrpms.net/


1.How to install RPM in linux ?


 #rpm –ivh packagename  // To install a RPM we need to use -i option.

2. How to remove a RPM ?


 #rpm -e packagename  // To remove a RPM file we need to use -e option.

3.How to Upgrade a RPM ?


 #rpm -Uvh packagename // To upgrade a RPM we need to use -U option.

4.How to check installed RPM?

 #rpm -qa packagename   // To list or find a installed RPM we need to use -q option.

5. How to List all files of an installed RPM package

 #rpm -ql packagename   // To list all files of installed rpm we need to use -ql ( query list) option.

6.How to Install a RPM Package Without Dependencies

 #rpm -ivh --nodeps packagename // To install a RPM without any dependencies we need to use --nodeps option.

7.How to check dependencies of RPM Package before Installing

 #rpm -qpR packagename   // To check the dependeny for a RPM we need to use -qpR option.


  -q : Query a package
  -p : List capabilities this package provides.
  -R: List capabilities on which this package depends.

8. How to Check an RPM Signature for a Package?


  #rpm --checksig  packagename.rpm    // We need to use the option --checksig for signature verification.

9. How to List Recently Installed RPM Packages


  #rpm -qa --last   // To list recently installed RPM we need to use --last option

10. How to Query a file that belongs which RPM Package


  #rpm -qf /etc/passwd         // To find a file owned by which package 

11.Get the Information of RPM Package Before Installing


  #rpm -qip packagename 

12. How to Verify a RPM Package


  #rpm -Vp  // To verify the installed RPM 

13.How to List all Imported RPM GPG keys


  #rpm -qa gpg-pubkey*


14. How to Remove an RPM Package Without Dependencies


  #rpm -ev --nodeps packagename // same --nodeps option we need to use


15. How To rebuild Corrupted RPM Database

  # cd /var/lib
  # rm __db*
  # rpm --rebuilddb
  # rpmdb_verify Packages


Linux Performance issue - Command Line tools

Linux Performance issue

Below discussed commands are mostly used to check linux performance issues such as

1. To find out bottlenecks.
2. Disk or storage I/O bottlenecks.
3. CPU and memory bottlenecks.
4. Network bottlenecks.



Below are the commonly used command line tools in linux.


#1. TOP - To view the process Activity on server

#2. VMSTAT - Its Used to check System Activity, Hardware and System Information


    Display Memory utilization  : #vmstat -m
    Display about active/inactive memory page info  : #vmstat -a

#3. PS  - To display the process
 
    #ps -axu


    #ps -auxf | sort -nr -k 3 | head -10  : To display Top 10 CPU Consuming process

#4. free - To display Memory utlization

#5. iostat - Average CPU Load, Disk Activity

    iostat reports CPU statistics for devices , partitions and netowrk file systems.

#6. SAR - To collect and report system activity

    #sar -n DEV  : To view netowrk counter

    # sar -n DEV -f /var/log/sa/sa20 | more  : To view 20th network counter info.

#7. MPSTAT - To display Multiprocessor usage

    #mpstat -P ALL   : To display average CPU utilization per processor:

#8. PMAP : To display Process Memory usage.

    # pmap -d PID

#9. NETSTAT : To view Network statistics.

    #netstat -an

    #netstat -s  #To view TCP connections

    #netstat -nat | awk '{print $6}' | sort | uniq -c | sort -n

    #netstat -nat |grep {IP-address} | awk '{print $6}' | sort | uniq -c | sort -n  // To view about particular IP address access on server.


#10. TCPDUMP # Detailed netowrk traffic analysis

   #tcpdump -i eth1 'udp port 53'

#11. ETHTOOL : Display or change ethernet card settings

   #ethtool ethX

   # ethtool -i eth0  // To display ethernet device driver settings

   #ethtool -a eth0  //To display autoneg settings

   #ethtool  -s eth0 autoneg off  //To set the parameter for netowrk card

   #ethtool -s eth0 speed 100 autoneg off  //To change the speed of network card



#12. MII-TOOL : This utility checks or sets the status of a network interface's Media Independent Interface (MII) unit.

   # mii-tool -v  // Display information about the network card

   # mii-tool -F 100baseTx-HD //To Change Duplex settings

  

#13. /proc File system: It provides detailed information about various hardware devices and other Linux kernel information

     # cat /proc/cpuinfo
     # cat /proc/meminfo
     # cat /proc/zoneinfo
     # cat /proc/mounts
     # cat /proc/scsi
   



VMWARE Products And Features Over View


VMware's products  mainly divided into two parts.


A.Data center/server virtualization

B.Desktop virtualization


VMware's core server virtualization hypervisor is ESX Server, but it is offered as the vSphere suite and in various editions with associated features 
(vSphere was previously known as VMware Infrastructure). A requirement for implementing VMware's vSphere is one of the editions of vSphere, plus VMware's virtualization management software, vCenter.





A. Data center/server virtualization

1.Free ESXi edition
2.vSphere 4/ESX Server
3.vCenter Server
4.VMware Server
5.vCenter Site Recovery Manager
6.VMware Data Recovery
7.Cloud products

Cloud Products such as - VMware vCloud Suite & vCloud Networking and Security & vCloud Automation Center


1.Free ESXi edition: the free version of VMware ESX/ESXi that allows you to consolidate servers while still using VMware's enterprise-grade hypervisor

2.vCenter Server: the centralized management server that manages all ESX servers and enables most vSphere features

3.VMware Server: a free virtualization platform that runs in an existing Windows or Linux operating system

4.vSphere 4/ESX Server: Includes ESX and ESXi plus a number of features, depending on the edition of the vSphere suite that you select. 
                      Note that all these features require you to purchase vCenter Server (outlined below). 

   Some vSphere features are the following:

   VMotion: moved running virtual machines (VMs) from one server to another
   Storage VMotion (SVMotion): moves the virtual disks of a running virtual machine from one        data store to another
   VMware High Availability (or VMware HA, VMHA): reboots running VMs on another ESX server    if an ESX host goes down
   Fault Tolerance (FT): moves a running VMs from one ESX server to another if the server they    run on goes down
   Distributed Power Management (DPM): when demand is low on a virtual infrastructure,            running VMs are consolidated onto fewer servers, and unused servers are powered off
   VMware Consolidated Backup (or VCB): this VMware backup tool enables you to back up        running virtual machines using an existing backup application
   vShield Zones: creates a virtual firewall within your virtual infrastructure


5.Vcenter site recovery :  Mainly used for disaster recovery purpose.

6.Vmware data recovery  VDP: (VDP) is the ideal backup and re and recovery solution to protect small vSphere environments, enabling fast and efficient backups to disk and, more importantly, fast and reliable recovery.


B.Desktop virtualization
    

1.VMware View (includes VMware VDI): used to consolidate desktop PCs into your virtual infrastructure
    
2.VMware Workstation: allows you to run multiple operating systems on your desktop PC

In further post will see more about the VMWARE products.




VMWARE Certification Roadmap - Details


VMWARE Certifications :

Below are the VMWARE certification list,


CLOUD

VMware Certified Professional – Cloud (VCP-Cloud)
VMware Certified Advanced Professional – Cloud Infrastructure Design (VCAP-CID) NEW
VMware Certified Advanced Professional – Cloud Infrastructure Administration (VCAP-CIA) NEW
VMware Certified Advanced Professional – Cloud Governance Coming Soon
VMware Certified Design Expert – Cloud (VCDX-Cloud) NEW

DATA CENTER VIRTUALIZATION 

vSphere 4
VMware Certified Professional 4 - Data Center Virtualization (VCP4-DCV)
VMware Certified Advanced Professional 4 - Data Center Administration (VCAP4-DCA)
VMware Certified Advanced Professional 4 - Data Center Design (VCAP4-DCD)
VMware Certified Design Expert 4 - Data Center Virtualization (VCDX4-DCV)

vSphere 5
VMware Certified Professional 5 – Data Center Virtualization (VCP5-DCV)
VMware Certified Advanced Professional 5 - Data Center Administration (VCAP5-DCA)
VMware Certified Advanced Professional 5 - Data Center Design (VCAP5-DCD)
VMware Certified Design Expert 5 - Data Center Virtualization (VCDX5-DCV)


END USER COMPUTING

VMware Certified Associate 4 - Desktop (VCA4-DT)
VMware Certified Professional 4 - Desktop (VCP4-DT)
VMware Certified Professional 5 - Desktop (VCP5-DT)
VMware Certified Advanced Professional - Desktop Administration (VCAP-DTA) Coming Soon
VMware Certified Advanced Professional - Desktop Design (VCAP-DTD) NEW
VMware Certified Design Expert – Desktop (VCDX-DT) Coming Soon

CLOUD APPLICATION PLATFORM

Certified Spring Professional
Certified Spring Web Application Developer
Certified Spring Enterprise Integration Specialist


VMWARE Certification Roadmap:






Note:

* VCP5 has been renamed VCP5-DCV (VMware Certified Professional 5 – Data Center Virtualization).
* VCDX has been renamed VCDX-DCV (VMware Certified Design Expert – Data Center Virtualization).



What does the echo "1" to the issue_lip file do? - SCAN SCSI in Linux


Question 1:  What will happen if we issue the below command ?

# echo "1" > /sys/class/fc_host/host/issue_lip


Answer : 

    This operation performs a Loop Initialization Protocol (LIP) and then scans the interconnect and causes the SCSI layer to be updated to reflect the devices currently on the bus. A LIP is, essentially, a bus reset,  and will cause device addition and removal. This procedure is necessary to configure a new SCSI target on a Fibre Channel interconnect. Bear in mind that issue_lip is an asynchronous operation.

    The command may complete before the entire scan has completed. You must monitor /var/log/messages to determine when it is done. The lpfc and qla2xxx drivers support issue_lip


Question2 : 

What will happen if we issue the below command ? what does "- - -" mean in the command?

# echo "- - -" > /sys/class/scsi_host/host0/scan


Answer: 

It means that you are echoing a wildcard value of "channel target and lun", and the operating system will rescan the device path.



Blogger Tips and TricksLatest Tips And TricksBlogger Tricks