Monday, December 12, 2016

Linux Interview Question - Linux basic 3

1. How to check memory stats and CPU stats.?
Ans: Using vmstat command we can check memory stats and CPU stats. We can also check memory usage and CPU usage in real time using top command

2. How to change the default run level in Linux.?
Ans: In RHEL/Centos 5/6 by changing the value in /etc/inittab file as mentioned below
[root@Arkit-RHEL6 ~]# vi /etc/inittab |grep id
# Individual runlevels are started by /etc/init/rc.conf
id:5:initdefault:
3. What are the default ports used for SMTP,DNS,FTP,DHCP, SSH and HTTP.?
Ans:
SMTP = 25
DNS = 53
FTP = 20 and 21
DHCP = 67 and 68
SSH = 22
HTTP = 80 and HTTPS = 443

4. How to check which ports are listening in my Linux Server.?
Ans: Using nmap, netstat and lsof commands we can check which are the ports listening in local host
Command Examples:
# nmap -sT -O localhost 
# ss -tunlap
# netstat -anp
5. How to add & change the kernel parameters.?
Ans: We can change the kernel parameters using /etc/sysctl.conf file

6. What is Puppet Server.?
Ans: Puppet software is a open-source configuration management tool. Which will support for multiple operating system such as Unix-like systems and Microsoft windows.

7. What are Symbolic Links and hard links.?
Ans: Symbolic links are the links which reference to actual files with other nicknames. We can add symbolic links to files and directories.

8. How to you execute more than one command or programs from Crontab entry.?
Ans: It is well possible to run/execute more commands from single crontab schedule by adding semicolon in between multiple commands.# crontab -e * * * * * cat /etc/passwd; ls -l /etc/ >> /tmp/etcfiles

9. Write a command that will look for files with an extension “c”, the string “apple” in it.?
Ans:
# find / -name "*.c" -print | xargs grep apple
10. What, if anything, is wrong with each of the following commands
ls -l-s
cat file1, file2
ls -s Factdir

Ans: There is no space used in ls -l-s command. Correct command is ls -l -s. In cat command we do not use ,(comma) for reading multiple files. Correct command is cat file1 file2

11. What is the difference between cron and anacron.?
Ans: cron jobs will run when server/machine is online 24/7. Anacron does not required to be online 24/7 like server when machine is switched on scheduled jobs will run

12. What are the fields in the /etc/passwd file.? Please explain.?
Ans:
# cat /etc/passwd
charan:x:1003:1003:Administrator from HYD:/home/charan:/bin/bash
charan = User Name
1003 = UID
1003 = GID group id
Administrator from HYD = Description of the user
/home/charan = Home directory of charan user
/bin/bash = Default shell prompt is bash for charan user

13. How Environment variable is set so that the file permissions assign the newly created files.?
Ans: By setting umask value newly created files will get default permissions

14. If you have only on IP address, but you want to host two web sites. What will you do.?
Ans: Create multiple virtual hosts using different ports

15. How do you check for the httpd.conf consistency..?
Ans: Using apachectl configtest command we check http.conf file consistency and errors

16. What is ‘.htaccess’ file in Apache web server.?
Ans: .htaccess file is a Hypertext Access file which is used to write URL redirection and SSL certification configuration etc..

17. In ‘kill -9’ command, what is the ‘-9’ signal indicates..?
Ans: -9 represent SIGKILL which means Kill signal

18. What are the process states in Unix.?
Ans:
Running State
Stopped State
Sleeping State
Uninterrupted sleep state
Defcunt State Or zombie State

19. List out different multi-processing modules in Apache web server description about it.?
Ans: mpm_worker_module is a module multi-processing module

20. What are the different storage engines used in MySQL..?
Ans:
Below are the few MySql storage engines
MyISAM.
InnoDB.
Memory.
CSV.
Merge.
Archive.
Federated.
Blackhole.

No comments:

Post a Comment