Linux-Interview-Questions

1. What is ldd?
List dynamic dependencies – print shared library dependencies.
2. What is the command to uninstall processes in Linux?
rpm –e servicenmae
yum remover servicename
3. What is the command for finding the highest memory occupied file in Linux?
du –ah / | sort –n –r | head –n 1
du – estimate file space usage
-a – write counts for all files, not just directories
-h – print sizes in human readable format (eg. 1K 234M 2G)
sort – sort lines of text files
-n – compare according to string numerical value
-r – reverse the result of comparisons
head – output the first part of files
-n – number of lines
4. What are the Linux boot files?
1./boot/grub/grub.conf: contains boot disk parameters
2./etc/fstab: contains File systems which need to mount at boot time
3./etc/initab: Contains default run level
4./etc/init.d/rc.d/rcN.d: This is a dir it contains
5. Difference between swap partition and swap file?
Swap partition is maintained as a separate partition. Same swap partition can be used for two OS within single machine.
Suppose if the system crashes, there is a chance to recover or it may not  corrupt the partition.
Less fragmented.
Where as swap file takes very less space. We can increase the space very easily, compared to swap partition. Swap file system fragmented.
If  the system crashes then there is a huge chance to lost the swap file system.
6. A file which is not deleted by normal user and also root (using rm), for that type of file how we delete it?
Using chattr command, we need to change the attributes and then we remove using rm command.
Eg: – chattr -iIu example
rm -rf example
7. Difference between nfs soft and hard mounting points?
Hard mount option: – If the client fails to access the server, then the connection hangs and once the system is up then it will again access the server.
Soft: – If the client failed to connect the server, it immediately gives the error report and closes the connection.
8. If we transfer 100 files by ftp to remote server, how to know the files are successfully transfer or some file are not transferred?
ftp>mput 1 2 3 …. 100
ftp> ls –l
9. I know ssh, telnet, dns,apache all are worked on TCP/UDP but i want to know any one service which are working on UDP only?
snmptrap 162/udp
snmptrap – simple network management protocol trap
snmptrapd is an SNMP application that receives and logs
10. I want to built a fire wall using iptables. My condition is ” inbound to 192.168.0.2 with a port of 80 from 172.168.0.1 should accept”
iptables –A INPUT –p tcp –dport 80 –s 172.168.0.1 –d 192.168.0.2 –j ACCEPT
11. I want to see how many interfaces (Ethernet cards) are working using single command?
ifconfig
12. What is the status code 403,404 represented in apache server?
403 represent forbidden error, means if a file misses some selinux security context.
404 represent that there is a cgi script missing or web pages missing.
13. How to monitor ports in a linux machine, with single command?
nmap localhost
14. In my linux machine, i lost /etc/passwd file and /etc/shadow file, then how can i recover it?
Normally in linux we must have backup by default for /etc/passwd and /etc/shadow files
/etc/passwd —> /etc/passwd-
/etc/shadow —> /etc/shadow-
from there we can copy or restore. If both are not available. Then follow below steps:
1. reboot
2. Single user mode [ single init=/bin/bash ]
3. pwconv
4. check /etc/passwd and /etc/shadow files are there
5. sync
6. init 3 or reboot with init 3

15. what r the different command to check ram,process and hdd of linux machine
To check ram in your system:
#free

To check process
#ps
#top
To check hdd
#fdisk
#sfdisk -l
16.If i run ls command it will show me the junk output what is problem and how to resolve it
Set your terminal setting by stty and before that, export ls command to PATH variable
17. WHAT IS THE MEANING OF AIX
AIX (Advanced Interactive eXecutive) is an open operating system from IBM which is based on a version of UNIX. AIX/ESA was designed for IBM’s System/390 or large server hardware platform. AIX/6000 is an operating system that runs on IBM’s workstation platform, the RISC System/6000.
18. Why ls -F dev/log file output indicate as = sign at end of the file name?
Standard output
19. What is nis server?
NIS is a service that provides any user on a network with the same working environment irrespective of the system on that network, which has been used for login purpose.
For example if NIS server is set up in a single system and configured to hold user accounts and their passwords and access information. Then any user on that network can login to his/her account from any system (with nis client running) on that configured network. This gives a look and feel that the user is logged into his/her own system. But actually it’s the account on the NIS server that is mounted on the local sytem user login.
20. What command can you use to review boot messages?
Dmesg
21. Who invented unix?
Unix was created in 1969 by Ken Thompson and Dennis Ritchie at Bell Laboratories.
22. Write a cron entry for the following scenario:- At 10:30 AM for every Sunday of every 1st month of a quarter.
30 10 * 1-12/3 7
23. What is the difference between RHEL4 & RHEL5?
RHEL4: No yum server, Selinux, secure, no cd key
RHEL5: yum server, advanced selinux, more secure, virtualization
24. What is the command to make a process to run in the foreground from background?
When the process is running, press “control+Z”. Now at the command prompt, type “bg”
25. What are the init levels in Linux?
7 level


No comments:

Post a Comment