UMASK in Linux: How to set permission with UMASK ?

UMASK  : Permission Set When New File / Folder Created

UMASK known as User Mask or it is also called User File creation MASK. This is a kind of base permission or default permission given when new file or folder is created in Linux box. Most of the distribution of Linux gives 022 as default UMASK.

So 022 is the default permission for files and folders

while create any file or directory in Linux, they are governed by umask setting. In case, any system administrator does not set the default umask will be 0000. This means that the new files created will have read and write permissions for each user and new directories will have read, write and execute permissions.

How can we calculate UMASK in Linux?

One thing is umask value is generally same for files and folders but the calculation of these values based on the permissions on files and directories are different.

Minimum UMASK value for directory : 000 and Maximum : 777
Minimum UMASK value for file: 000 and Maximum : 666

Reason of keeping maximum value 666 for files is because script files and binary files in Linux should only have execute permissions. Normal files in Linux should only have read and write permissions. Normally, umask are calculated through bitwise AND operator. Some of the common octal notations are:

0 – Read, Write and Execute
1 – Read and Write
2 – Read and Execute
3 – Read Only
4 –Write and Execute
5 –Write Only
6 –Execute Only
7 –No Permissions

Now, we can easily make use of the above mentioned table to calculate permission for files. For instance, if an umask is set to 077 means the permission is generally calculated as below:

Targeted at
File permission
read, write and execute
No permissions
No permissions

To set the above umask, you should type the command

$ umask 077
$ mkdir folder3
$ touch testfile3
$ ls –ld folder3  testfile3

drwx—— 2 demo demo 4096 2013-07-04 01:34 folder3
-rw——- 2 demo demo 0 2013-07-04 01:34 testfile3

Display current umask value

If you run umask command without any argument it will display the current mask value.

$ umask

How can we set umask with Symbolic Values?

Below mentioned are the symbolic values we can use:
r: read, w: write, x: execute, u: user ownership, g: group ownership and o: other ownership

$ umask u=rwx, g=, o=
$ mkdir folder1
$ touch testfile
$ ls –ld folder1 testfile

Procedure To Setup Default umask

You can setup umask in /etc/bashrc or /etc/profile file for all users. By default most Linux distro set it to 0022 (022) or 0002 (002). Open /etc/profile or ~/.bashrc file, enter:

# vi /etc/profile
$ vi ~/.bashrc
Append/modify following line to setup a new umask:
umask 022

Save and close the file. Changes will take effect after next login. All UNIX users can override the system umask defaults in their /etc/profile file, 

~/.profile (Korn / Bourne shell) 
~/.cshrc file (C shells), 
~/.bash_profile (Bash shell)
~/.login file (defines the user's environment at login).

umask and level of security:

The umask command be used for setting different security levels as follows:

umask value
Security level
Effective permission (directory)

What are the Limitations of umask?

  1. The umask command can restricts permissions.
  2. The umask command cannot grant extra permissions beyond what is specified by the program that creates the file or directory. If you need to make permission changes to existing file use the chmod command.

Migrate physical to virtual Machine using Converter

Below Video will explain how to migrate a physical machine in to virtual machine.

Converter Down Load Link :

Copy file to USB-stick

# mount USB-stick:

# mkdir /mnt/usbstick

# mount –t vfat /dev/sdb1 /mnt/usbstick

copy archive file to home folder:

#cd /mnt/usbstick

#cp VMware-converter-4.0.1-161434.tar.gz ~

#cd ~

#tar –zxf VMware-converter-4.0.1-161434.tar.gz

#cd vmware-converter-distrib

# ./

Follow the instructions

Run VMware Converter:


Microsoft ODBC Driver installation on Linux

The Below post will explain how to install Microsoft ODBC driver on Linux server.

Here i have installed on Redhat Linux 5.8 server

Why we need ODBC driver?

The Microsoft ODBC Driver For SQL Server provides native connectivity from Windows to Microsoft SQL Server and Windows Azure SQL Database.

Prerequisites for Installing

This driver is only supported on 64-bit Red Hat Enterprise Linux 5 or
64-bit Red Hat Enterprise Linux 6. Other configurations are not supported
and will not likely work.

The following libraries must be installed for the driver to work:

RedHat 5:

RedHat 6:

Most likely these libraries are installed, as they should come installed by
default on the supported versions of RedHat Linux.

Important: Delete any driver manager packages installed on your computer before you install the unixODBC Driver Manager. Installing the unixODBC Driver Manager could cause a failure of an existing Driver Manager.

The installation script can verify most of these configuration
prerequisites by running:

./ verify

Step 1:

Down load the ODBC Driver Manager from below link. This driver manager will help to install ODBC Driver in linux server

File name : msodbcsql-11.0.2270.0.tar.gz

Copy the downloaded file to server /tmp directory

#tar -zxvf msodbcsql-11.0.2270.0.tar.gz

#cd msodbcsql-11.0.2270.0

#./ --help  ( Check the available command options in build command)

What If The Driver Manager Isn't Configured Properly?

You may build a properly configured unixODBC Driver Manager using the script included.  However, if this script is unable to
complete, you may configure and build the proper driver manager yourself
using the instructions below:

Step 2 : 

1. Remove any older installed version of unixODBC (for example, unixODBC
2.2.11).  On Red Hat Enterprise Linux 5 or 6, you can do this by executing
the following command: yum remove unixODBC.

2. Go to

3. Click the Download link, on the left side of the page.

4. Click the Download link, on the next page, and save the file
unixODBC-2.3.0.tar.gz to your computer.

5. On your Linux computer, execute the following command: tar xvzf

6. Change to the unixODBC-2.3.0 directory.

After copy the file you will get files like below in  your directory.

Step 3:

Copy the downloaded driver to below location 

#cp /tmp/unixODBC-2.3.0.tar.gz /tmp/msodbcsql-11.0.2270.0

Execute the following command to begin the unixODBC Driver Manager installation: 

#./ --download-url=file://unixODBC-2.3.0.tar.gz.

#cd /tmp/unixODBC.5062.15565.23677/unixODBC-2.3.0; make install

#cd /tmp/msodbcsql-11.0.2270.0

# ./ install

#./ verfiy

You can confirm the ODBC driver installed on server using below command

# odbcinst -q -d -n "ODBC Driver 11 for SQL Server"

Changing Priority of Process in Linux

What is Priority?

When talking about processes priority is all about managing processor time. The Processor or CPU is like a human juggling multiple tasks at the same time. Sometimes we can have enough room to take on multiple projects. Sometimes we can only focus on one thing at a time. Other times something important pops up and we want to devote all of our energy into solving that problem while putting less important tasks on the back burner.

In Linux we can set guidelines for the CPU to follow when it is looking at all the tasks it has to do. These guidelines are called niceness or nice value. The Linux niceness scale goes from -20 to 19. The lower the number the more priority that task gets. If the niceness value is high number like 19 the task will be set to the lowest priority and the CPU will process it whenever it gets a chance. The default nice value is zero.

1.Checking the Priority of Running Processes?



Another way you can get the nice value using ps command

#ps -o pid,comm,nice -p 2077   //2077 is the process ID


[root@serverA ~]# ps -o pid,comm,nice -p 2077
  PID COMMAND          NI
 2077 scopeux         -20
[root@serverA ~]#

2.Setting priority on new processes?

To change the priority when issuing a new command

#nice -n [nice value] [command]


#nice -n 10 apt-get upgrade

This will increment the default nice value by a positive 10 for the command, ‘apt-get upgrade‘

3.Setting Priority on Existing/running Processes?

To change the priority of an existing process just do

#renice [nice value] -p [process id]


#renice 10 -p 2077

This will increment the priority of the process with an id of 21827 to 10.

4.Setting Permanent Priority on all Processes for a Specific User ?

Sometimes it is helpful to give specific users lower priority than others to keep system resources allocated in the proper places like core services and other programs.

You can set the default nice value of a particular user or group in the /etc/security/limits.conf file.

#vi /etc/security/limits.conf

dbuser hard priority 1

>save and exit

It uses this syntax: [username] [hard|soft] priority [nice value]

How to change Time zone in Linux

Method 1: Creating link file to corresponding Timezone

# cd /etc
# rm localtime  //delete the existing localtime file

Check the available time zones in US

# ls /usr/share/zoneinfo/US/    
Alaska          Arizona         Eastern         Hawaii          Michigan        Pacific
Aleutian        Central         East-Indiana    Indiana-Starke  Mountain        Samoa

Note: For other country timezones, browse the /usr/share/zoneinfo directory

Now we can change the time zone using below step

# ln -sf /usr/share/zoneinfo/Asia/Calcutta localtime

Now check the time


# date
Mon Aug 17 23:10:14 IST 2013

But if you are doing any patching then after patching this Time zone will get changed. So this method is not perfect one.


Method 2: Change TimeZone Using /etc/timezone File

# vi /etc/timezone

then export the TZ variable

$ export TZ=America/Los_Angeles
$ date

Method 3: Command line tools.

Using below interactive method also we can change the Time zone

Ubuntu: dpkg-reconfigure tzdata
Redhat: redhat-config-date
CentOS/Fedora: system-config-date
FreeBSD/Slackware: tzselect

FS extend and FS reduce in RHEL 4 ??

How to reduce FS size in RHEL4 ??

Step 1: umount /fs
step 1: e2fsck -f /dev/vg??/lvol??
Step 2: resize2fs /dev/vg??/lvol?? "New Size"
step 3: lvreduce -L "new Size" /dev/vg??/lvol??
step 4: mount /fs

Example i have reduced /mnt/u001 FS size from 58GB to 50GB. Check the below output

ServerA:/tmp# umount /mnt/u001

ServerA:/tmp# e2fsck -f /dev/mapper/vg01-lvol0
e2fsck 1.35 (28-Feb-2004)
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
/dev/mapper/vg01-lvol0: 254375/7602176 files (0.4% non-contiguous), 8528446/15204352 blocks

ServerA:/tmp# resize2fs /dev/mapper/vg01-lvol0 50G
resize2fs 1.35 (28-Feb-2004)
Resizing the filesystem on /dev/mapper/vg01-lvol0 to 13107200 (4k) blocks.

The filesystem on /dev/mapper/vg01-lvol0 is now 13107200 blocks long.


ServerA:/tmp# lvreduce -L 50G /dev/mapper/vg01-lvol0
  WARNING: Reducing active logical volume to 50.00 GB
  THIS MAY DESTROY YOUR DATA (filesystem etc.)
Do you really want to reduce lvol0? [y/n]: y
  Reducing logical volume lvol0 to 50.00 GB
  Logical volume lvol0 successfully resized
ServerA:/tmp# lvdisplay /dev/mapper/vg01_app-lvol0
  --- Logical volume ---
  LV Name                /dev/vg01/lvol0
  VG Name                vg01
  LV UUID                ZbIk91-8OUL-Wleo-MfzZ-QkvV-A2c2-amKGil
  LV Write Access        read/write
  LV Status              available
  # open                 0
  LV Size                50.00 GB
  Current LE             12800
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           253:35


Now FS size 

serverA:/tmp# df -hP /mnt/u001
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/vg01-lvol0   50G   32G   16G  67% /mnt/u001

How to extend a FS in RHEL 4??

Step 1 : lvextend -L +size "lvolname"
Step 2 : ext2online "lvolname"

serverA:/tmp# lvextend -L +5G /dev/mapper/vg01_app-lvol8
  Extending logical volume lvol8 to 90.98 GB
  Logical volume lvol8 successfully resized

serverA:/tmp# ext2online /dev/mapper/vg01_app-lvol8
ext2online v1.1.18 - 2001/03/18 for EXT2FS 0.5b

serverA:/tmp# df -hP /mnt/u006
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/vg01_app-lvol8   90G   81G  7.7G  92% /mnt/u006

Locked VMDK files in ESXi server

 In ESX/ESXi 2.0

To determine which ESX host has locked the file:

    # vmkfstools -D vmhba0:2:0:8
    # less /var/log/vmkernel
    Look for the string lock=  in the affected ESX hosts .vmdk file. This IP address is the IP of the ESX host that created the lock.
    Jul  3 10:13:22 cs_tse_d03 vmkernel: 13:20:24:17.562 cpu0)File descriptor 3 (RZ_NLB_TESTW2003EE1.vmdk) is allocated
    Jul  3 10:13:22 cs_tse_d03 vmkernel: 13:20:24:17.562 cpu0)^Ilength=6291456000 toolsVersion=6313 hwVersion=3 lock= RO=0
    Note: lock= indicates that a file is not locked by another host.

In ESX/ESXi 3.x/4.x and ESXi 5.0

How to check VMDK fiel locked or not ?

# vmkfstools -D /vmfs/volumes/LUN/VM/disk-flat.vmdk

You see output similar to:

Lock [type 10c00001 offset 54009856 v 11, hb offset 3198976
gen 9, mode 0, owner  4655cd8b-3c4a19f2-17bc-00145e808070  mtime 114]
Addr <4, 116, 4>, gen 5, links 1, type reg, flags 0, uid 0, gid 0, mode 600
len 5368709120, nb 0 tbz 0, cow 0, zla 3, bs 1048576


    The owner 4655cd8b-3c4a19f2-17bc-00145e808070 indicates that the MAC address of the ESX/ESXi host locking the file is 00:14:5E:80:80:70.

    Note: If the owner has the entry 00000000-00000000-0000-000000000000 it indicates that the file has either a read-only lock or a multi-writer lock or there is no lock on the file.

    The mode indicates the type of lock that is on the file. The list of mode locks are:

        mode 0 = no lock
        mode 1 = is an exclusive lock (vmx file of a powered on VM, the currently used disk (flat or delta), *vswp, etc.)
        mode 2 = is a read-only lock (e.g. on the ..-flat.vmdk of a running VM with snapshots)
        mode 3 = is a multi-writer lock (e.g. used for MSCS clusters disks or FT VMs).

3.With ESX 3.x/4.x and ESXi 5.0 you can use the lsof command on the host holding the lock to attempt to identify the process which is holding the lock:

# lsof |grep /vmfs/volumes/LUN/VM/disk-flat.vmdk

4.Once identifed the process which is locking VMDK , we can kill that using #kill -9 PID.


Clearing the file lock by rebooting the ESX host  

As a final troubleshooting step, try restarting the ESX host that holds the lock.   To restart the ESX host:  

Note: Prior to restarting the entire VMware ESX host, restart the management agents. For more information see Restarting the Management agents on an ESX or ESXi Server (1003490).

   1.Migrate all virtual machines from the host to new hosts.
   2.When the virtual machine are moved, place the host in maintenance mode and reboot.Note:
   If you have only one ESX host or do not have the ability to migrate virtual machines, you must schedule a downtime for all affected virtual machines prior to rebooting. When the host has rebooted, start the affected virtual machine.

Free up space in Linux & Reserved block size in Linux


root@ServerA# df -h
Filesystem            Size  Used Avail Use% Mounted on

/dev/sda1              99M   13M   85M  14% /boot
none                  2.9G     0  2.9G   0% /dev/shm
/dev/sda1             148G  146G  1.1G 100% /u01
/dev/sdb1              74G   71G  2.2G  98% /u02
/dev/sdc1              74G   71G  1.6G  98% /u03

The above disk status shows that /dev/sda1 is 100% used but still there is 1.1G free space available.


This is because of reserved block unix size in linux.

#tune2fs -m 1 /dev/sda1

What is reserved Blocks ?

Reserved blocks are disk blocks reserved by the kernel for processes owned by privileged users to prevent operating system from a crash due to unavailability of storage space for critical processes. 
For example, just imagine the size of root file system is 14 GB and the root file system is 100% full, all the non privileged user processes would not be able to write data to the root file system whereas processes which are owned by  privileged user (root by default) would still be able to write the data to the file system. With the help of reserved blocks, operating system keeps running for hours or sometimes days even though root file system is 100% full.

The default percentage of reserved block is 5 % of the total size of file system and can be increased or decreased based upon the requirement.

Reserved blocks are supported on ext2 and ext3 file system(s)

How to check how many blocks are reserved :

#dumpe2fs -h /dev/VolGroup00/LogVol00  | grep -i block

dumpe2fs 1.39 (29-May-2006)
Block count: 3637248
Reserved block count:  181862
Free blocks: 2709898
First block:  0
Block size:  4096
Reserved GDT blocks:  887
Blocks per group:  32768
Inode blocks per group:   1024
Reserved blocks uid:  0 (user root)
Reserved blocks gid:  0 (group root)
Journal backup:   inode blocks

In above example, Block Count (Total Blocks) = 3637248 and Reserved Block Count = 181862 so the reserved block percentage option is set to 181862/3637248*100 i.e. 5 % (default value).


# tune2fs -l /dev/sdb1

How to change reserved block percentage value :

The value for Reserved Block Percentage can be set at the time of creating the file system as well as after creating the file system.

1) At the time of creation of file-system:

# mkfs.ext3 -m 1/dev/sda2 (replace sda2 with your partition name)

2) To set the reserved block percentage value after creating file system, use the following command

# tune2fs -m 3 /dev/VolGroup00/LogVol00

Above command would set the reserved block percentage value to 3 % of total block count. Which user can access reserved blocks

Linux LVM Interview Questions : Part 2

Questions: PART 2

1.What are LVM1 and LVM2?
2.What is the maximum size of a single LV?
3.List of important LVM related files and Directories?
4.What is the steps to create LVM in Linux?
5.How to extend a File system in Linux?
6.How to reduce the File system size  in Linux?
7.How to add new LUN from storage to Linux server?
8.How to resize root file system on RHEL 6?
9.How to find server is configured with LVM RAID ? 
10.How to check Linux server is configured with power path disks?
11.How to check server is configured with Multipath disks??


1.What are LVM1 and LVM2?

LVM1 and LVM2 are the versions of LVM. 
LVM2 uses device mapper driver contained in 2.6 kernel version.
LVM 1 was included in the 2.4 series kernels.

2.What is the maximum size of a single LV?

For 2.4 based kernels, the maximum LV size is 2TB. 
For 32-bit CPUs on 2.6 kernels, the maximum LV size is 16TB.
For 64-bit CPUs on 2.6 kernels, the maximum LV size is 8EB. 

3.List of important LVM related files and Directories?

## Directories
/etc/lvm                - default lvm directory location
/etc/lvm/backup         - where the automatic backups go
/etc/lvm/cache          - persistent filter cache
/etc/lvm/archive        - where automatic archives go after a volume group change
/var/lock/lvm             - lock files to prevent metadata corruption

# Files
/etc/lvm/lvm.conf       - main lvm configuration file
$HOME/.lvm              - lvm history 

4.What is the steps to create LVM in Linux?

Create a physical volume by using pvcreate command

consider the disk is local.

#fdisk -l 

#fdisk /dev/sda

Press "n" to create new partition. And mention the size / allocate whole disk to single partition. and assign the partition number also.

#press "t" to change the partition as LVM partition. 

#enter "8e" ( 8e - is Hex decimal code for LVM ) 

#Enter "w" to write tghe information on Disk.

#fdisk -l ( Now you will get newly created disk numbers)

#pvcreate /dev/sda2

Add physical volume to volume group by “vgcreate” command

#vgcreate VLG0 /dev/sda2

Create logical volume from volume group by “lvcreate” command.

#lvcreate -L 1G -n LVM1 VG0

Now create file system on /dev/sda2 partition by “mke2fs”  or "mkfs.ext3" command.

#mke2fs -j /dev/VG0/LVM1


#mkfs.ext3 /dev/vg0/LVM1

How to mount this as file system

#mkdir /test

#mount /dev/VG0/LVM1 /test  

5.How to extend a File system in Linux?

Check the free space on vg 

#vgdisplay -v VG1

Now extend the FS

# lvextend -L+1G /dev/VG1/lvol1

# resize2fs /dev/VG1/lvol1

6.How to reduce the File system size  in Linux?

1.First we need to reduce the file system size using "resize2fs"
2.Then reduce the lvol size using "lvreduce"

#resize2fs -f /dev/VolGroup00/LogVol00 3G

#lvreduce -L 5G /dev/VG1/Lvol1

7.How to add new LUN from storage to Linux server?

Step 1: Get the list of HBA and exisiting disk details.

#ls /sys/class/fc_host

#fdisk -l 2>/dev/null | egrep '^Disk' | egrep -v 'dm-' | wc -l

Step 2: Scan the HBA ports (Need to scan all HBA port)

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

# echo "- - -" > /sys/class/scsi_host/host??/scan

Do this above steps for all HBA cards

Step3 : Check the newly added Lun     

# cat /proc/scsi/scsi | egrep -i 'Host:' | wc -l

# fdisk -l 2>/dev/null | egrep '^Disk' | egrep -v 'dm-' | wc -l

Once found the disk then do below steps to add to VolumeGroup

#pvcreate /dev/diskpath

#vgextend /dev/vg1 /dev/diskpath

#vgs or #vgdisplay /dev/vg1

8.How to resize root file system on RHEL 6?

Here is the list of steps to reduce the  root file system (lv_root) on a RHEL 6 Linux server:

Boot the system into rescue mode. Do not mount the file systems (select the option to 'Skip' in the rescue mode and start a shell)

Bring the Volume Group online

#lvm vgchange -a -y

Run fsck on the FS

#e2fsck -f /dev/vg_myhost/lv_root

Resize the file system with new size

#resize2fs -f /dev/vg00/lv_root 20G

Reduce the Logical Volume of the FS with the new size

#lvreduce -L20G /dev/vg00/lv_root

Run fsck to make sure the FS is still ok

#e2fsck -f /dev/vg00/lv_root

Optionally mount the file system in the rescue mode

#mkdir -p /mnt/sysimage/root
#mount -t ext4 /dev/mapper/vg00-lv_root /mnt/sysimage/root
#cd /mnt/sysimage/root

Unmount the FS

#umount /mnt/sysimage/root

Exit rescue mode and boot the system from the hard disk

Select the reboot option from the recue mode

9.How to find server is configured with LVM RAID ? 

1.How to check linux LVM RAID ?

 check the RAID status in /proc/mdstat

 #cat /proc/mdstat 
 # mdadm --detail /dev/mdx
 # lsraid -a /dev/mdx

2.Check the Volume group disks 

 #vgdisplay -v vg01

 In disk we will get the device names like /dev/md1 , /dev/md2 . It means LVM RAID disks are configured and its added to Volume Group.

10.How to check Linux server is configured with power path disks?

1.Check power path is installed on server?

#rpm -qa |grep -i emc

2.Check the power path status on server?

#/etc/init.d/PowerPath status

#chkconfig --list PowerPath

# lsmod |grep -i emc

3.Check the Volume group disks 

 #vgdisplay -v vg01

 In disk we will get the device names like /dev/emcpowera , /dev/emcpowerb . It means powerpath disks are configured and its added to Volume Group.

4.Check the power path disk status using below command

 #powermt display dev=all

11.How to check server is configured with Multipath disks??

# ls -lrt /dev/mapper  //To View the Mapper disk paths and Lvols

#dmsetup table 

#dmsetup ls 

#dmsetup status

2.Using Multipathd Command ( Daemon ) 

#echo 'show paths' |multipathd -k

#echo 'show maps' |multipathd -k

3.Check multipath Daemon is running or not 

#ps -eaf |grep -i multipathd

4.check the VG disk paths

#vgs or vgdisplay -v vg01 

If multipath disks are added and configured with VG then we will get disk paths like /dev/mpath0 , /dev/mpath1.

5.If you want to check the disk path status u can use below command also

#multipathd -k

#multipathd> show multipaths status

#multipathd> show topology

#multipathd> show paths

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


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

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

Blogger Tips and TricksLatest Tips And TricksBlogger Tricks