Here, I am very pleased to share my Interview experience with you and have shared 10 Linux interview questions and answeres  on this post.

1. How do you change default runlevel 5 to 3 and which file need to update?

The file located  /etc/inittab and required to change below lines:
save the file and restart  system.

 2. How do you take  entire  MySQL database by command ?
Can take a  entire mysql backup using mysqldump command as below,
# mysqldump –u root   --all-databases >  alldatabasebak.sql

3.  How to Enable and disable  directories or files  listing on browser ?
Its possible in apache conf file  or .htaccess file. open httpd.conf file and add the below line to Enable the directory listing on browser,
 Options +Indexes
To disable the directory listing on browser
Options  -Indexes
save the file and restart apache.

4.What is the structure of virtual host in Apache?
We can configure multiple virtual host in httpd.conf files  

DocumentRoot /home/thelinuxfaq/public_html/
ErrorLog /usr/local/apache/log/error_log
CustomLog /var/log/virtualmin/ _access_log combined

5. Is it possible to change DocumentRoot and Port numbers ?
Yes,We can  change the DocumentRoot and Port number  in httpd.conf file, the DcoumentRoot is  located under  VirtualHost.

DocumentRoot /home/thelinuxfaq/public_html/

The apache default port number is 80 if I want to change to 8081  find “Listen” line and update it.
Example :

Listen 8081
Once updated in httpd.conf files restart apache.

6. How  to copy iso file from the  drive (cd /dvd )?
It can be done using dd command,
# mkdir /var/isofile
dd if=/dev/sda0 of=/var/isofile/isoname.iso

7. Linux runlevels explained?
0    Halt    System halt (Do NOT set init default to this)
1    Single-User Mode    Allow non-root logins
2    Multiuser, without NFS    Does not configure network.
3    Full multiuser mode     Starts the system normally.
4    Unused    Not used
5    X11     Full multi-user mode
6    Reboot    Reboots the system (Do not set init default to this)

8. How to Enable IP Forwarding in Linux?
Open  /etc/sysctl.conf file  and set the value,
# vi /etc/sysctl.conf
Set net.ipv4.ip_forward  0 to 1,

# Controls IP packet forwarding
net.ipv4.ip_forward = 1

Save and close the file. Reload the changes by execute below command,
# sysctl –p

9.  What is use of FINGER command?
The Finger command use to find information about system users, it Lists out Login name, Full name, Login time, Shell access details, Directory permission and Email Address.
# finger linuxfaq
Login: linuxfaq                         Name: (null)
Directory: /home/linuxfaq               Shell: /usr/local/cpanel/bin/noshell
Never logged in.
No mail.
No Plan.

10. How to change Port redirection in iptables?.
Assume that the Port 80 redirect to 8080,

#  iptables -t nat -A PREROUTING -p tcp -m tcp --dport 80 -j REDIRECT --to-ports 8080
#  iptables -t nat -A PREROUTING -p udp -m udp --dport 80 -j REDIRECT --to-ports 8080

Interview Questions-2
Interview Questions-3
Interview Questions-L2