Mahindra Satyam Frequently Asked Linux Interview Questions

What Is The Command To View All The Kernel Parameters?

sysctl -a

What Is The Default Permission Applied On The User When You Mount A Nfs Permission On Any Local Directory In Your System?

No user permission which is a system account in all the machines having normal user level privileges unless no_root_squash or any other permission specification is not provided on the share.

What Is The Difference Between Nfs Share And A Samba Share?

NFS sharing is done between linux to Linux where Samba sharing can be done between Linux-Linux and Linux-windows

What Is The Command To Display All The Logical Volume Available In The System?

lvdisplay

What Is A Swap Partition ? What Is The Recommended Swap Partition For 8 Gb Ram?

Swap partition is a feature used in Linux which uses the space allocated to it from the physical hard drive and is utilized by te system when RAM memory goes full.

Amount of RAM in the System  Recommended Amount of Swap Space
4GB of RAM or less  a minimum of 2GB of swap space
4GB to 16GB of RAM  a minimum of 4GB of swap space
16GB to 64GB of RAM  a minimum of 8GB of swap space
64GB to 256GB of RAM  a minimum of 16GB of swap space
256GB to 512GB of RAM  a minimum of 32GB of swap space
Mahindra Satyam Frequently Asked Linux Interview Questions Answers
Mahindra Satyam Frequently Asked Linux Interview Questions Answers

What Is E2fsck Command?

fsck is a front end tool for e2fsck.

When The System Runs The Fsck And Which Script Invokes It?

When the system boots,  the rc.sysinit script runs the fsck on any filesystems marked for checking in /etc/fstab file. If any of these filesystems are markes as dirty or have data in the journal, fsck will attempt to repair them. If it succeeds, the filesystems will be mounted and boot process continues, else rc.sysinit will  run sulogin and will report that fsck needs to be run manually.

Why Fsck Used?

fsck (file system check) is used to maintain file system consistency.

How To Create A Swap File?

Create a file as

         # dd  if=/dev/zero  of=swapfile   bs=512  count=N
         (Where N is the file size in KB)
         Run the mkswap to create signature
         Activate the swap file with swapon command (OR) initialize it in the startup
         script /etc/rc.d/rc.local

How To Set Up Swap Partition?

Steps involved in setting up swap partition

Create a partition using a partitioning program (fdisk/sfdisk/parted)
Set partition id type to 0x82.
Create the signature on the partition using the mkswap command
# mkswap  -v1  /dev/hdb3
Add an entry for the swap in /etc/fstab file as
/dev/hdb3   swap   swap   defaults    0   0
Activate the swap partition using
# swapon -a
Check the swap partition status using
# swapon  -s

What Is The Command Used To Check Any Hardware Changes Made On The System In Linux?

kudzu

What Is The Difference Between Ext3 And Ext4 Filesystem?

Ext3

Maximum individual file size can be from 16 GB to 2 TB
Overall ext3 file system size can be from 2 TB to 32 TB
Ext4

Maximum individual file size can be from 16 GB to 16 TB
Overall maximum ext4 file system size is 1 EB (exabyte). 1 EB = 1024 PB (petabyte). 1 PB = 1024 TB (terabyte).

What Is The Filesystem Used In Rhel 5 And Rhel 6?

Ext3 for RHEL 5 and ext4 for RHEL 6.

What Is The Function Of Resize2fs Command?

This can be used to change the size of an ext2 or ext3 filesystem.

What Is The Function Of Debugfs Command?

This utility is used to to examine and debug an ext2 filesystem. This can also be used to manually verify the inode integrity and an aid to recover data.

How To Create A Filesystem?

The mkfs command is used to create the filesystem.

mkfs.ext2 / mkfs.ext3>To create ext2/ext3 filesystem
mkfs.minix> minix filesystem
mkfs.msdos> MS-DOS filesystem

What Is The Function Of Partprobe?

Reinitializes the kernel's in memory copy of the partition table.

What Are The Tools Used To Create Or Manage Partitions?

fdisk
sfdisk
parted (GNU) - An advanced partition manipulation tool (create, copy,resize etc.)

Why Partitions Required?

Separate partitions improve performance by keeping data together which reduces the disk head seek.

How Many Partitions Are Supported By Linux?

The maximum number of partitions supported by Linux kernel is

63 for IDE drives

15 for SCSI drives.

What Is The Function Of Dump2fs Command?

Provides a dump of file system information to standard out (Console). Can be redirected to a file.

What Is The Function Of Tune2fs Command?

This is used to modify the filesystem attributes (Like converting ext2 to ext3).

Types Of Journals And Their Function?

Ordered : This is the default and journal only meta-data
Journaled : Journals data and meta-data
Writeback : Journal updates are not atomic.

What Is Swap Space?

Swap space is supplement to system RAM.

What Is The Function Of /etc/fstab?

This file is referenced each time the system boots to create the desired filesystem hierarchy.

How To Display The Label For A Device (/dev/hdb2)?

# e2lable  /dev/hdb2

What Is The Function Of E2label Command?

With the help of e2label command a filesystem label can be written into the superblock of ext2/ext3 filesystem.
 Eg:-           #e2label  /dev/hda3  datadisk3
Will create a label of datadisk3 on the filesystem on partition /dev/hda3.

How To View Only The Mounted Filesystems?

Use the df -k command, which shows only mounted filesystems but has the big advantage of giving you the mount points too.

How To View All The Mounted And Unmounted Partitions?

Use the fdisk -l command to view all the mounted and unmounted filesystems available on your system.

How To Kill All Actions On A Filesystem?

# fuser  -km  mnt_point

How To Display Who/what Is Acting On A Filesystem?

# fuser  -v  mnt_point

Which Command Is Used To Display Information About The Processes Using A Filesystem?

The fuser command is used.

How To Convert An Ext2 Filesystem To Ext3?

 Change the /etc/fstab to specify ext3 for desired filesystem(s)
            Create the ext3 journal on the ext2 filesystem(s) as
            # tune2fs  -j
            If the kernel needs to have access to the ext3 module at boot time, create  a new initial ramdisk as
            # mkinitrd  /boot/initrd-.img

What Are The Journaling Modes Supported By Ext3 Filesystem?

Ordered>Journals only metadata (This is the default)
Journaled>Journals data as well as metadata
Writeback> Journal updates are not atomic, but this gives better performance.

What Is The Difference Between Ext2 And Ext3 Filesystem?

ext3 filesystem supports journaling, where as ext2 does not.

What Is The Use Of “$?” Sign In Shell Script?

While writing a shell script, if you want to check whether previous command is executed successfully or not, then we can use “$?” with if statement to check the exit status of previous command.

Basic example is shown below

root@localhost:~# ls /usr/bin/shar

/usr/bin/shar

root@localhost:~# echo $

0

If exit status is 0 , then command is executed successfully

root@localhost:~# ls /usr/bin/share

ls: cannot access /usr/bin/share: No such file or directory

root@localhost:~# echo $

2

If the exit status is other than 0, then we can say command is not executed successfully.

How To Compare Numbers In Linux Shell Scripting?

Test command is used to compare numbers in if-then statement.

Example is shown below

#! /bin/bash

x=10

y=20

if [ $x -gt $y ]

then

echo “x is greater than y”

else

echo “y is greater than x”

fi

Post a Comment

Previous Post Next Post