Vous êtes sur la page 1sur 23

1

Q: What do you mean a File System?


File System is a method to store and organize files and directories on disk. A file system can
have different formats called file system types. These formats determine how the information is
stored as files and directories.
Q: Tell me all steps to remove a LVM?
To remove a logical volume from a volume group, first unmount it with the umount command:
umount /dev/<vgname>/<lvname>
and then use the lvremove command:
lvremove /dev/<vgname>/<lvname>
Q: Which command is used to create LVM Snapshot?
vcreate size <size> -s -n <snapshotname> <lvname>
The lvcreate command is used to create a new logical volume, meaning there must be free
physical extents in the logical volume group to create a snapshot. The -s option means that the
LV is a snapshot, <snapshotname> is the name of the new LV created, and <lvname> is the
name of the LV from which to create the snapshot.
Q: What is the location of "network" file and what does this contains?
location :- /etc/sysconfig/network
This file contains following fields
NETWORKING=yes
NETWORKING_IPV6=no
HOSTNAME=localhost.localdomain
Q: Which deamon is required to start Network services?
network
/etc/init.d/network start
Q: Tell me the name of directory structure hierarchy for Linux
/root
/boot
/bin
/sbin
/proc
/mnt
/usr
/var
/lib
/etc
/dev
/opt
/srv

/tmp
/media

Q: What is the role of /etc/resolv.conf file?


In this file we sets the DNS servers (using their IP addresses) and the search domain. The values
of the DNS servers are often added when the network is activated because the data can be
provided by DHCP or a similar service.
Q: Is there any relation between modprobe.conf file and network devices?
Yes, This file assigns a kernel module to each network device.
For Example :[root@localhost ~]# cat /etc/modprobe.conf
alias eth0 b44
Here b44 is the kernel module for network device eth0.
We can Confirm by following command (This module b44 is present or not).
[root@localhost ~]# lsmod |grep b44
b44
29005 0
Q: What does /boot directory contains?
The /boot/ directory contains static files required to boot the system, such as the Linux kernel,
boot loader configuration files. These files are essential for the system to boot properly.
Q: What is the role of udev daemon?
The udev demon used to create and remove all these device nodes or files in /dev/ directory.
Q: How to install Linux softwares by RPM?
rpm -ivh test-1.0-1.i386.rpm
Q: If a file associated with test-1.0-1.i386.rpm deleted, than How we will recover that file?
We can reinstall this rpm again.
Q: Which options are required to upgrade a RPM?
Upgrading a package is similar to installing one. Type the following command at a shell
prompt:
rpm -Uvh test-2.0-1.i386.rpm
Q: In which directory RPM database stored?
/var/lib/rpm
Q: Tell me the name of device file for PS/2 mouse connection.
/dev/psaux
Q: If you are getting error "package is already installed" but you have to install package any
how. what option you will use?
rpm -ivh test-1.0-1.i386.rpm
Preparing ########################################### [100%] package test-1.0-1
is already installed

In this case you can use "replacepkgs" option.


rpm -ivh replacepkgs test-1.0-1.i386.rpm
Q: Explain the command "rpm -qa"?
It will queries all currently installed packages.
Q: Tell me the name of device file for parallel port (Printers).
/dev/lp0

Q:1 Why LVM is required ?


Ans: LVM stands for Logical Volume Manager , to resize filesystems size online we required
LVM partition in Linux. Size of LVM partition can be extended and reduced using the lvextend
& lvreduce commands respectively.
Q: What is the difference between LVM and RAID?
RAID provides redundancy but LVM doesnt provide Redundancy.
Q: 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.
Q: What is physical extent (PE)?
Each physical volume is divided chunks of data, known as physical extents; these extents
have the same size as the logical extents for the volume group.
Q: What is logical extent (LE)?
Each logical volume is split into chunks of data, known as logical extents. The extent size is
the same for all logical volumes in the volume group.
Q: What command is used to remove the password assigned to a group?
gpasswd -r
Q: What is Volume group (VG)?
The Volume Group is the highest level abstraction used within the LVM. It gathers
together a collection of Logical Volumes and Physical Volumes into one administrative
unit.
Q: Explain LVM snapshot?
LVM snapshots allow the administrator to create a new block device which presents an
exact copy of a logical volume, frozen at some point in time.
Q: What can you type at a command line to determine which shell you are using?
echo $SHELL

Q: Explain the command "rpm -qf "?


it queries the RPM database for which package owns <filename>. When
specifying a file, specify the absolute path of the file.
Q: How to verify all installed packages?
rpm -Va
Q: 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

Q: Which configuration file is required to change the Run Level of


Server or system?
/etc/inittab
To change the default run level, modify this line.
id:5:initdefault:
Q: Any idea about ext4 file system?
The ext4 or fourth extended filesystem is a journaling file system developed as
the successor to ext3. Ext4 filesystem released as a functionally complete and
stable filesystem in Linux with kernel version 2.6.28.
Features of ext4 file system:-

1. Currently, Ext3 supports 16 TB of maximum file system size and 2 TB of


maximum file size. Ext4 have 1 EB of maximum file system size and 16 TB of
maximum file size.
[An EB or exabyte is 1018 bytes or 1,048,576 TB]
2. Fast fsck check than ext3
3 In Ext4 the journaling feature can be disabled, which provides a small
performance improvement.
4. Online defragmentation.
5. Delayed allocation
Ext4 uses a filesystem performance technique called allocate-on-flush, also
known as delayed allocation. It consists of delaying block allocation until the
data is going to be written to the disk, unlike some other file systems, which
may allocate the necessary blocks before that step.
Q: How to verify the signature of an rpm?
rpm -K test-1.0-1.i386.rpm
Q: Explain architectures required for RPMs?
noarch Architecture-independent, can run on any architecture
i386

Generic build for a 32-bit x86 system

i586

Sometimes used when building kernels for older x86 processors

Intel Pentium II, Intel Pentium III, Intel Pentium 4, AMD Athlon, and
i686

AMD Duron systems (Most RPMs for these architectures are built using

the i386 architecture, with the kernel for these architectures being built with the
i686 for optimal performance.)
x86_64 64-bit processors such as AMD Athlon64, AMD Opteron, and Intel
EM64T
ia64

Intel Itanium

ppc

32-bit IBM POWER, IBM eServer pSeries, and IBM eServer iSeries

s390x 64-bit IBM eServer System z

Q: How we create ext3 file system on /dev/sda7 disk?


# mkfs j /dev/sda7

Yes, we can convert ext2 to ext3 file system by tune2fs command.


tune2fs j

/dev/<Block-Device-Name>

Q: What "neat" command will do?


neat command provides Graphical interface to change network settings for
network devices.
Q: Which protocol is required to allow local printing and print
sharing?
Internet Printing Protocol (IPP) is required to allow local printing and print
sharing.
Q: What is SWAP Space?
Swap space in Linux is used when the amount of physical memory (RAM) is full.
If the system needs more memory resources and the RAM is full, inactive pages
in memory are moved to the swap space. While swap space can help machines
with a small amount of RAM, it should not be considered a replacement for
more RAM. Swap space is located on hard drives, which have a slower access
time than physical memory.
Q: What are the steps to create SWAP files or Partition?
Create swap partition or file
Write special signature using mkswap
Activate swap space by swapon a command
Add swap entry into /etc/fstab file

Q: How you will create swap file of size 4 GB and explain swap file
entry in /etc/fstab file?
Use dd command to create swap file.
dd if=/dev/zero of=/SWAPFILE bs=1024 count=4
mkswap /SWAPFILE
swapon a
Entry into /etc/fstab file.
/SWAPFILE

swap

swap

defaults

Q: 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.
Q: How we will create ext4 file system?
# mke2fs -t ext4 /dev/DEV

Q: What does /etc/X11/ directory contains?


The /etc/X11/ directory is for X Window System configuration files, such as
xorg.conf.
Q: How to list PCI Devices on your server or System?
use "lspci" command.
Q: What is the role of "Kudzu"?
Kudzu is used to Detect new Hardware.
Q: How to Enable ACLs for /home partition?
Add following entry in /etc/fstab

LABEL=/home

/home

ext3

acl

1 2

Now remount /home partition with acl option.


mount -t ext3 -o acl /dev/sda3 /home
Q: How to View ACLs for a file(test_file)?
getfacl test_file
Q: What does /etc/skell directory contains?
The /etc/skel directory contains files and directories that are automatically
copied over to a new user's home directory when such user is created by
the useradd or adduser command.
Q: What does /etc/X11/ directory contains?
The /etc/X11/ directory is for X Window System configuration files, such as
xorg.conf.
Q: How to list PCI Devices on your server or System?
use "lspci" command.
Q: What is the role of "Kudzu"?
Kudzu is used to Detect new Hardware
Q: How to Enable ACLs for /home partition?
Add following entry in /etc/fstab
LABEL=/home

/home

ext3

acl

1 2

Now remount /home partition with acl option.


mount -t ext3 -o acl /dev/sda3 /home

Q: How to View ACLs for a file(test_file)?


getfacl test_file
Q: What does /etc/skell directory contains?
The /etc/skel directory contains files and directories that are automatically
copied over to a new user's home directory when such user is created by
the useradd or adduser command.
Q: What happens when you add a new device after installation?
The Kudzu program runs each time the system boots and performs a hardware
probe. If new hardware is found, Kudzu attempts to map it to a kernel module.
If successful, the information is saved, and the device is configured.
Q: How to remove an ACL?
setfacl remove-all <file-name>
Q: Tell me name of Linux File systems?
Ext2
Ext

Q:2 How To check Memory stats and CPU stats ?


Ans: Using free & vmstat command we can display the physical and virtual memory
statistics respectively.With the help of sar command we see the CPU utilization & other stats.
Q:3 What does Sar provides and at which location Sar logs are stored ?
Ans: Sar Collect, report, or save system activity information. The default version of the sar
command (CPU utilization report) might be one of the first facilities the user runs to begin
system activity investigation, because it monitors major system resources. If CPU utilization is
near 100 percent (user + nice + system), the workload sampled is CPU-bound.
By default log files of Sar command is located at /var/log/sa/sadd file, where the dd parameter
indicates the current day.
Q:4 How to increase the size of LVM partition ?
Ans: Below are the Logical Steps :
Use the lvextend command (lvextend -L +100M /dev/<Name of the LVM Partition> , in this

10

example we are extending the size by 100MB.


resize2fs /dev/<Name of the LVM Partition>
check the size of partition using df -h command
Q:5 How to reduce or shrink the size of LVM partition ?
Ans: Below are the logical Steps to reduce size of LVM partition :
-Umount the filesystem using umount command,
-use resize2fs command , e.g resiz2fs /dev/mapper/myvg-mylv 10G
-Now use the lvreduce command , e.g lvreduce -L 10G /dev/mapper/myvg-mylv
Above Command will shrink the size & will make the filesystem size 10GB.
Q:6 How to create partition from the raw disk ?
Ans: Using fdisk utility we can create partitions from the raw disk.Below are the steps to create
partition from the raw dsik :
fdisk /dev/hd* (IDE) or /dev/sd* (SCSI)
Type n to create a new partition
After creating partition , type w command to write the changes to the partition table.
Q:7 Where the kernel modules are located ?
Ans: The /lib/modules/kernel-version/ directory stores all kernel modules or compiled drivers
in Linux operating system. Also with lsmod command we can see all the installed kernel
modules.
Q:8 What is umask ?
Ans: umask stands for User file creation mask, which determines the settings of a mask that
controls which file permissions are set for files and directories when they are created.
Q:9 How to set the umask permanently for a user?
Ans: To set this value permanently for a user, it has to be put in the appropriate profile file which
depends on the default shell of the user.
Q:10 How to change the default run level in linux ?
Ans: To change the run level we have to edit the file /etc/inittab and change initdefault entry (
id:5:initdefault:). Using init command we change the run level temporary like init 3 , this
command will move the system in runlevl 3.
Q:11 How to share a directory using nfs ?
Ans: To share a directory using nfs , first edit the configuration file /etc/exportfs , add a entry
like
/<directory-name> <ip or Network>(Options) and then restart the nfs service.
Q:12 How to check and mount nfs share ?
Ans: Using showmount command we can see what directories are shared via nfs e.g
showmount -e <ip address of nfs server>.Using mount command we can mount the nfs share
on linux machine.

11

Q:13 What are the default ports used for SMTP,DNS,FTP,DHCP,SSH and squid ?
Ans: Service Port
SMTP
25
DNS
53
FTP
20 (data transfer) , 21 ( Connection established)
DHCP
67/UDP(dhcp server) , 68/UDP(dhcp client)
SSH
22
Squid
3128
Q:14 What is Network Bonding ?
Ans: Network bonding is the aggregation of multiple Lan cards into a single bonded interface to
provide fault tolerance and high performance. Network bonding is also known as NIC Teaming.
Q:15 What are the different modes of Network bonding in Linux ?
Ans: Below are list of modes used in Network Bonding :
balance-rr or 0 round-robin mode for fault tolerance and load balancing.
active-backup or 1 Sets active-backup mode for fault tolerance.
balance-xor or 2 Sets an XOR (exclusive-or) mode for fault tolerance and load balancing.
broadcast or 3 Sets a broadcast mode for fault tolerance. All transmissions are sent on all
slave interfaces.
802.3ad or 4 Sets an IEEE 802.3ad dynamic link aggregation mode. Creates aggregation
groups that share the same speed & duplex settings.
balance-tlb or 5 Sets a Transmit Load Balancing (TLB) mode for fault tolerance & load
balancing.
balance-alb or 6 Sets an Active Load Balancing (ALB) mode for fault tolerance & load
balancing.
Q:16 How to check and verify the status the bond interface.
Ans: Using the command cat /proc/net/bonding/bond0 , we can check which mode is enabled
and what lan cards are used in this bond. In this example we have one only one bond interface
but we can have multiple bond interface like bond1,bond2 and so on.
Q:17 How to check default route and routing table ?
Ans: Using the Commands netstat -nr and route -n we can see the default route and routing
tables.
Q:18 How to check which ports are listening in my Linux Server ?
Ans: Use the Command netstat listen and lsof -i
Q:19 List the services that are enabled at a particular run level in linux server ?
Ans: With the help of command chkconfig list | grep 5:on we can list all the service that are
enabled in run level5. For other run levels just replace 5 with the respective run level.
Q:20 How to enable a service at a particular run level ?

12

Ans: We can enable a service using the Command chkconfig <Service-Name> on level 3
Q:21 How to upgrade Kernel in Linux ?
Ans: We should never upgrade Linux Kernel , always install the new New kernel using rpm
command because upgrading a kenel can make your linux box in a unbootable state.
Q:22 How To scan newly asssigned luns on linux box without rebooting ?
Ans: There are two ways to scan newly assigned luns :
Method:1 if sg3 rpm is installed , then run the command rescan-scsi-bus.sh
Method:2 Run the Command , echo > /sys/class/scsi_host/hostX/scan
Q:23 How to find WWN numbers of HBA cards in Linux Server ?
Ans: We can find the WWN numbers of HBA cards using the command systool -c fc_host -v |
grep port_name
Q:24 How to add & change the Kernel parameters ?
Ans: To Set the kernel parameters in linux , first edit the file /etc/sysctl.conf after making the
changes save the file and run the command sysctl -p , this command will make the changes
permanently without rebooting the machine.

Q:25 What is Puppet Server ?


Ans: Puppet is an open-source & enterprise software for configuration management toll in UNIX
like operating system. Puppet is a IT automation software used to push configuration to its
clients (puppet agents) using code. Puppet code can do a variety of tasks from installing new
software, to check file permissions, or updating user accounts & lots of other tasks.
Q:26 What are manifests in Puppet ?
Ans: Manifests in Puppet are the files in which the client configuration is specified.
Q:27 Which Command is used to sign requested certificates in Puppet Server ?
Ans: puppetca sign hostname-of-agent in (2.X) & puppet ca sign hostname-of-agent
in (3.X)
Q:28 At which location Puppet Master Stores Certificates ?
Ans: /var/lib/puppet/ssl/ca/signed
Q:29 How to find all the regular files in a directory ?
Ans: using the command find /<directory -type f.
Q:30 What is load average in a linux ?

13

Ans: Load Average is defined as the average sum of the number of process waiting in the run
queue and number of process currently executing over the period of 1,5 and 15 minutes. Using
the top and uptime command we find the load average of a linux sever.
Q:1 What is Virtualization ?

Ans: Virtualization is a technique for creating virtual resources (rather than the actual) such as
server, storage device, network and Operating system. Virtualization is dis-associating the tight
bond between software and hardware.
Q:2 What are the different types of Virtualization ?

Ans: Virtualization can be used in different ways and can take many different forms. Some of
them are listed below :
Server Virtualization
Network Virtualization
Hardware virtualization
Application virtualization
Desktop virtualization
User virtualization
Q:3 What is the difference between full virtualization & para virtualization ?

Ans: Full virtualization & para virtualization both comes under the Hardware virtualization.
Some of the difference between them are listed below :
Full Virtualization : It is a virtualization in which guest machine(virtual machines) is unware
that it is in virtualized environment therefore hardware is virtualized by the host operating
system so that the guest can issue commands to what it thinks is actual hardware but really are
just simulated hardware devices created by the host
Para Virtualization : It is a virtualization in which guest machine is aware that it is in
virtualized environment . If guest machine require resources like memory & cpu , it issues
command to guest operating system instead of directly communication with actual hardware.
Q:4 What is hypervisor ?

Ans: Hypervisor is a peace of a software that is being install on the physical machine , which
then further creates and run virtual machines. Virtual machine are known as guest machines and
host machine is the hypervisor on which different virtual machines are created.
Q:5 What are different hypervisors available in Linux ?

Ans: Xen & KVM are two hypervisor available in linux.


Q:6: What is the difference between Xen & KVM ?

Ans: For Xen hypervisor first we have to install Xen kernel and have to boot the machine with
Xen kernel where as KVM is kernel based Virtualization , we dont need any extra kernel for
KVM. KVM is a module in Kernel. Xen hypervisor by default doesnt support full virtualization
whereas KVM supports Full virtualization.
Q:7 What is Type-1 and Type-2 hypervisor ?

14

Ans: Type-1 hypervisor is bare metal hypervisor runs on bare metal of hardware. Hyper-V and
ESXI Server are the examples of type-1 hypervisor. Type-2 hypervisor is hosted by operating
system. Examples of type-2 hypervisor are Microsoft Virtual Server & VMware Server.
Q:8 What is Dom0 in Xen ?

Ans: Dom0 or Domain0 is the initial domain started by xen hypervisor. It has the special rights
like to start new domain and access the hardware directly. Dom0 is responsible for running all of
the device drivers for the hardware.
Q:9 How to verify Virtualization Technology (VT) is enabled in your servers BIOS or not ?

Ans : grep -E svm|vmx /proc/cpuinfo


vmx is for Intel processors
svm is for AMD processors
Q:10 What is the use of virsh command ?

Ans: virsh is the interface or command for managing the virtual machines based on KVM & Xen
hypervisor. On virsh interface virtual machines are identified by their domain names , so virsh is
generally used to list current domains , to create , pause & shutdown domains.
Q:11 How to identify the KVM version ?

Ans: To find the KVM version use the command virsh version
Q:12 Which command is used to list all virtual machine running on the KVM hypervisor ?

Ans: Using the command virsh list all we can list all virtual machines irrespective of their
states.
Q:13 How to forcefully shutdown the KVM based virtual machine from the command line
?
Ans: We can forcefully shutdown the VM using the command virsh destroy
machine_name.This command should only be used in a case where VM is in Hung state
because forcefully shutdowm may cause filesystem corruption.
Q:14 What are the basic requirements of VM live migration in KVM ?

Ans: Some of the basic requirements are listed below :


The guest image or virtual machine image must be located on a shared storage and it must
be accessible usingiSCSI, NFS, GFS2 or Fibre Channel.
The shared storage must be mounted on the same path on both the hypervisors / hosts.
Both hypervisors / hosts must run the same version of KVM.
Both guests or VMs must have the same network configuration & bridging configuration
(their IPs must be different)
Q:15 Which command is used in KVM for VMs live migration ?

Ans: virsh migrate live machine_name qemu+ssh://destination_server/system


Q:16 What are the different states of a VM in Xen hypervisor ?

Ans: A VM can have different states like


r Running

15

b Blocked
c crashed
s Shutdown
p Paused

Q:17 How to get the console of guest or virtual machine in Xen ?

Ans: xm console <domain-id>


Q:18 How to shutdown,reboot & start VMs ( domain-ids) in Xen ?

Ans: Use xm command :


#xmshutdown[domain-id]
#xmreboot [domain-id]
# xm start [domain-id]
Q:19 How to get hardware information of KVM guest machine ?

Ans: Use the command virsh dominfo <domain-name / VM Name>


Q:20 How to connect a particular VM using virt-viewer ?

Ans: virt-viewer -c qemu:///system <VM_Name>

Q:1 How to check current run level of a linux server ?


Ans: who -r & runlevel commands are used to check the current runlevel of a linux box.
Q:2 How to check the default gatway in linux ?
Ans: Using the commands route -n and netstat -nr , we can check default gateway. Apart
from the default gateway info , these commands also display the current routing tables .
Q:3 How to rebuild initrd image file on Linux ?
Ans: In case of CentOS 5.X / RHEL 5.X , mkinitrd command is used to create initrd file ,
example is shown below :
# mkinitrd -f -v /boot/initrd-$(uname -r).img $(uname -r)
If you want to create initrd for a specific kernel version , then replace uname -r with desired
kernel
In Case of CentOS 6.X / RHEL 6.X , dracut command is used to create initrd file example is
shown below :
# dracut -f
Above command will create the initrd file for the current version. To rebuild the initrd file for a
specific kernel , use below command :

16

# dracut -f initramfs-2.x.xx-xx.el6.x86_64.img 2.x.xx-xx.el6.x86_64


Q:4 What is cpio command ?
Ans: cpio stands for Copy in and copy out. Cpio copies files, lists and extract files to and from a
archive ( or a single file).
Q:5 What is patch command and where to use it ?
Ans: As the name suggest patch command is used to apply changes ( or patches) to the text file.
Patch command generally accept output from the diff and convert older version of files into
newer versions. For example Linux kernel source code consists of number of files with millions
of lines , so whenever any contributor contribute the changes , then he/she will be send the only
changes instead of sending the whole source code. Then the receiver will apply the changes with
patch command to its original source code.
Create a diff file for use with patch,
# diff -Naur old_file new_file > diff_file
Where old_file and new_file are either single files or directories containing files. The r option
supports recursion of a directory tree.
Once the diff file has been created, we can apply it to patch the old file into the new file:
# patch < diff_file
Q:6 What is use of aspell ?
Ans: As the name suggest aspell is an interactive spelling checker in linux operating system. The
aspell command is the successor to an earlier program named ispell, and can be used, for the
most part, as a drop-in replacement. While the aspell program is mostly used by other programs
that require spell-checking capability, it can also be used very effectively as a stand-alone tool
from the command line.
Q:7 How to check the SPF record of domain from command line ?
Ans: We can check SPF record of a domain using dig command. Example is shown below :
linuxtechi@localhost:~$ dig -t TXT google.com
Q:8 How to identify which package the specified file (/etc/fstab) is associated with in linux ?
Ans: # rpm -qf /etc/fstab
Above command will list the package which provides file /etc/fstab
Q:9 Which command is used to check the status of bond0 ?
Ans: cat /proc/net/bonding/bond0
Q:10 What is the use of /proc file system in linux ?
Ans: The /proc file system is a RAM based file system which maintains information about the
current state of the running kernel including details on CPU, memory, partitioning, interrupts,
I/O addresses, DMA channels, and running processes. This file system is represented by various

17

files which do not actually store the information, they point to the information in the memory.
The /proc file system is maintained automatically by the system.
Q:11 How to find files larger than 10MB in size in /usr directory ?
Ans: # find /usr -size +10M
Q:12 How to find files in the /home directory that were modified more than 120 days ago ?
Ans: # find /home -mtime +l20
Q:13 How to find files in the /var directory that have not been accessed in the last 90 days ?
Ans: # find /var -atime -90
Q:14 Search for core files in the entire directory tree and delete them as found without
prompting forconfirmation
Ans: # find / -name core -exec rm {} \;
Q:15 What is the purpose of strings command ?
Ans: The strings command is used to extract and display the legible contents of a non-text file.
Q:16 What is the use tee filter ?
Ans: The tee filter is used to send an output to more than one destination. It can send one copy of
the output to a file and another to the screen (or some other program) if used with pipe.
linuxtechi@localhost:~$ ll /etc | nl | tee /tmp/ll.out
In the above example, the output from ll is numbered and captured in /tmp/ll.out file. The output
is also displayed on the screen.
Q:17 What would the command export PS1 = $LOGNAME@`hostname`:\$PWD: do ?
Ans: The export command provided will change the login prompt to display username,
hostname, and the current working directory.
Q:18 What would the command ll | awk {print $3,owns,$9} do ?
Ans: The ll command provided will display file names and their owners.
Q:19 What is the use of at command in linux ?
Ans: The at command is used to schedule a one-time execution of a program in the future. All
submitted jobs are spooled in the /var/spool/at directory and executed by the atd daemon when
the scheduled time arrives.
Q:20 What is the role of lspci command in linux ?
Ans: The lspci command displays information about PCI buses and the devices attached to your
system. Specify -v, -vv, or -vvv for detailed output. With the -m option, the command produces
more legible output.
Q:1 How To check the uptime of a Linux Server ?
Ans: Using uptime command we can determine how long a linux box has been running , also
uptime can be viewed by the top & w command.
Q:2 How to check which Redhat version is installed on Server ?

18

Ans: Use the command cat /etc/redhat-release , output of this command will tell you the redhat
version.
Q:3 How to install rpm packages in Redhat & CentOS linux ?
Ans: rpm and yum command are used to install packages in redhat linux and CentOS.
Q:4 How to check the ip address of LAN Card ?
Ans: Using ifconfig & ip address command we can determine the ip address of LAN Card.
Q:5 How to determine the hostname of a linux box ?
Ans: On typing the hostname command on terminal we can determine the hostname of a linux
server.
Q:6 How To check the default gatway ?
Ans: Using route -n command we can determine the default gateway in linux.
Q:7 Which Command is used to check the kernel Version ?
Ans: uname -r
Q:8 How to check the current runlevel of a linux box ?
Ans : who -r and runlevel , both of these command are used to find current run level.
Q:9 What is Initrd ?
Ans: Initrd stands for initial ram disk , which contains the temporary root filesystem and
neccessary modules which helps in mounting the real root filesystem in read mode only.
Q:10 What is Bootloader ?
Ans: Bootloader is a program that boots the operating system and decides from which kernel OS
will boot.
Q:11 How to list hidden files from the command line ?
Ans: ls -a <Folder_Name>
Q:12 What is soft link ?
Ans: Soft link is a method to create short cuts in linux. It is similar to windows short cut feature.
Q:13 How to create a blank file in linux from command line ?
Ans: Using the command touch <file-name>
Q:14 What is run level 2 ?
Ans: Run level 2 is the multi-user mode without networking.
Q:15 Why linux is called OpenSource ?
Ans: Because One can customize the existing code and can redistribute it.
Q:16 How to check all the installed Kernel modules ?
Ans: Using the Command lsmod we can see the installed kernel modules.
Q:17 What is the default uid & gid of root user ?
Ans: Default uid & gid of root user is 0.
Q:18 How To change the password of user from the Command Line ?
Ans: passwd <User-Name>
Q:19 What is a Process ?

19

Ans: Any program in execution is called a process.


Q:20 What is name of first process in linux ?
Ans: init is the first process in linux which is started by kernel and whose pid is 1.
Q:1 What is the default port & configuration file of SSH Server ?
Ans: 22 is default port for ssh and /etc/ssh/sshd_config is the configuration file.
Q:2 How to change the default ssh port in linux ?
Ans: To change the port , first edit the file /etc/ssh/sshd_config , change the vaule of parameter port 22 , now
restart the ssh service.

Q:3 What is the configuration file of ssh client ?


Ans: /etc/ssh/ssh_config is configuration file for ssh client.

Q:4 What is SSH port forwarding ?


Ans: SSH Port Forwarding, sometimes called SSH Tunneling, which allows you to establish a secure SSH session
and then tunnel arbitrary TCP connections through it. Tunnels can be created at any time, with almost no effort and
no programming.

Syntax : ssh -L localport:host:hostport user@ssh_server -N


where:
-L port forwarding parameters
localport local port (chose a port that is not in use by other service)
host server that has the port (hostport) that you want to forward
hostport remote port
-N do not execute a remote command, (you will not have the shell, see below)
user user that have ssh access to the ssh server (computer)
ssh_server the ssh server that will be used for forwarding/tunneling
Without the -N option you will have not only the forwarding port but also the remote shell.
Q:5 How to disable the root login in linux server ?
Ans: Open the file /etc/ssh/sshd_config and chnage the paramenter PermitRootLogin yes to PermitRootLogin
no & restart the ssh service.

Q:6 How to allow only specific users to ssh your linux server ?
Ans: Open the file /etc/ssh/sshd_config and add the parameter AllowUsers user1 user2 & then restart the ssh
server.

Q:7 How to enable debugging in ssh command ?


Ans: To enable debugging in ssh command use -v option like ssh root@www.linuxtechi.com -v. To increase the
debugging level just increase the number of vs.

Q:8 What is the difference between ssh & Telnet ?


Ans: In ssh communication between client & server is encrypted but in telnet communication between the client &
server is in plain text . We can also say SSH uses a public key for authentication while Telnet does not use any
authentication.SSH adds a bit more overhead to the bandwidth compared to Telnet.Default port of ssh is 22 and for
telnet 23.

20

Q:9 What is use of sshpass command in linux ?


Ans: sshpass is a command which allows us to automatically supply password to the command prompt so that
automated scripts can be run as desired by users. sshpass supplies password to ssh prompt using a dedicated tty ,
fooling ssh to believe that a interactive user is supplying password.

Q:10 What is the use of scp command ?


Ans: SCP stands for Secure Copy ,it copies files between hosts over a network. It uses ssh for data transfer & uses
the same authentication and provides the same security as ssh. Unlike rcp, scp will ask for passwords or passphrases
if they are needed for authentication.

Q:11 What is the use of blowfish options in scp command ?


Ans: Using blowfish options in scp command , we can increase the speed, by default scp uses the Triple-DES cipher
to encrypt the data being copied.
Example : scp -c blowfish /home/itstuff.txt root@mail.linuxtechi.com:/opt/

Q:12 How to limit the bandwidth used by scp command ?


Ans: We can limit the bandwidth used by the scp command using the -l option as shown in the syntax.#scp -l
bandwidth_limit filename username@remote-host:/folder-name , where bandwidth_limit is numeric to be specified
in kilobits per second.

Q:13 How to enable passwordless ssh authentication in Linux ?


Ans: To Implement passwordless or Keys based authentication we have to generate Public and Private keys , Copy
the Pubic keys to remote Linux servers either manually or by ssh-copy-id command.ssh-copy-id command will
automatically copy the contents of id_rsa.pub file to ~/.ssh/authorized_keys file of remote linux server.

Q:14 How to check SSH servers Version ?


Ans: Using the command ssh -V we can find the ssh servers version.

Q:15 How to Copy the file server.txt from the local machine to a remote host using port
2751 in /opt folder.
Ans: scp -P 2751 /home/server.txt root@mail.linuxtechi.com:/opt

Q:1 What is postfix and default port used for postfix ?

Ans: Postfix is a open source MTA (Mail Transfer agent) which is used to route & deliver
emails. Postfix is the alternate of widely used Sendmail MTA. Default port for postfix is 25.
Q:2 What is the difference between Postfix & Sendmail ?

Ans: Postfix uses a modular approach and is composed of multiple independent executables.
Sendmail has a more monolithic design utilizing a single always running daemon.
Q:3 What is MTA and its role in mailing system ?

Ans: MTA Stands for Mail Transfer Agent.MTA receives and delivers email. Determines
message routing and possible address rewriting. Locally delivered messages are handed off to an
MDA for final delivery. Examples Qmail, Postfix, Sendmail
Q:4 What is MDA ?

21

Ans: MDA stands for Mail Delivery Agent. MDA is a Program that handles final delivery of
messages for a systems local recipients. MDAs can often filter or categorize messages upon
delivery. An MDA might also determine that a message must be forwarded to another email
address. Example Procmail
Q:5 What is MUA ?

Ans: MUA stands for Mail User Agent. MUA is aEmail client software used to compose, send,
and retrieve email messages. Sends messages through an MTA. Retrieves messages from a mail
store either directly or through a POP/ IMAP server. Examples Outlook, Thunderbird, Evolution.
Q:6 What is the use of postmaster account in Mailserver ?

Ans: An email administrator is commonly referred to as a postmaster. An individual with


postmaster responsibilities makes sure that the mail system is working correctly, makes
configuration changes, and adds/removes email accounts, among other things. You must have a
postmaster alias at all domains for which you handle email that directs messages to the correct
person or persons .
Q:7 What are the important daemons in postfix ?

Ans : Below are the lists of impportant daemons in postfix mail server :
master :The master daemon is the brain of the Postfix mail system. It spawns all other
daemons.
smtpd: The smtpd daemon (server) handles incoming connections.
smtp :The smtp client handles outgoing connections.
qmgr :The qmgr-Daemon is the heart of the Postfix mail system. It processes and controls
all messages in the mail queues.
local : The local program is Postfix own local delivery agent. It stores messages in
mailboxes.
Q:8 What are the configuration files of postfix server ?

Ans: There are two main Configuration files of postfix :


/etc/postfix/main.cf : This file holds global configuration options. They will be applied to
all instances of a daemon, unless they are overridden in master.cf
/etc/postfix/master.cf : This file defines runtime environment for daemons attached to
services. Runtime behavior defined in main.cf may be overridden by setting service specific
options.
Q:9 How to restart the postfix service & make it enable across reboot ?

Ans: Use this command to restart service Service postfix restart and to make the service
persist across the reboot, use the command chkconfig postfix on
Q:10 How to check the mails queue in postfix ?

22

Ans: Postfix maintains two queues, the pending mails queue, and the deferred mail queue,the
deferred mail queue has the mail that has soft-fail and should be retried (Temporary failure),
Postfix retries the deferred queue on set intervals (configurable, and by default 5 minutes)
To display the list of queued mails :
# postqueue -p
To Save the output of above command :
# postqueue -p > /mnt/queue-backup.txt
Tell Postfix to process the Queue now
# postqueue -f
Q:11 How to delete mails from the queue in postfix ?

Ans: Use below command to delete all queued mails


# postsuper -d ALL
To delete only deferred mails from queue , use below command
# postsuper -d ALL deferred
Q:12 How to check postfix configuration from the command line ?

Ans: Using the command postconf -n we can see current configuration of postfix excluding the
lines which are commented.
Q:13 Which command is used to see live mail logs in postfix ?

Ans: Use the command tail -f /var/log/maillog or tailf /var/log/maillog


Q:14 How to send a test mail from command line ?

Ans: Use the below command to send a test mail from postfix itself :
# echo Test mail from postfix | mail -s Plz ignore info@something.com
Q:15 What is an Open mail relay ?

Ans: An open mail relay is an SMTP server configured in such a way that it allows anyone on
the Internet to send e-mail through it, not just mail destined to or originating from known
users.This used to be the default configuration in many mail servers; indeed, it was the way the
Internet was initially set up, but open mail relays have become unpopular because of their
exploitation by spammers and worms.
Q:16 What is relay host in postfix ?

Ans: Relay host is the smtp address , if mentioned in postfix config file , then all the incoming
mails be relayed through smtp server.
Q:17 What is Greylisting ?

Ans: Greylisting is a method of defending e-mail users against spam. A mail transfer agent
(MTA) using greylisting will temporarily reject any email from a sender it does not recognize.
If the mail is legitimate the originating server will, after a delay, try again and, if sufficient time
has elapsed, the email will be accepted.
Q:18 What is the importance of SPF records in mail servers ?

23

Ans: SPF (Sender Policy Framework) is a system to help domain owners specify the servers
which are supposed to send mail from their domain. The aim is that other mail systems can then
check to make sure the server sending email from that domain is authorized to do so reducing
the chance of email spoofing, phishing schemes and spam!
Q:19 What is the use of Domain Keys(DKIM) in mail servers ?

Ans: DomainKeys is an e-mail authentication system designed to verify the DNS domain of
an e-mail sender and the message integrity. The DomainKeys specification has adopted aspects
of Identified Internet Mail to create an enhanced protocol called DomainKeys Identified
Mail (DKIM).
Q:20 What is the role of Anti-Spam SMTP Proxy (ASSP) in mail server ?

Ans: ASSP is a gateway server which is install in front of your MTA and implements autowhitelists, self learning Bayesian, Greylisting, DNSBL, DNSWL, URIBL, SPF, SRS,
Backscatter, Virus scanning, attachment blocking, Senderbase and multiple other filter methods

Vous aimerez peut-être aussi