Saturday, July 26, 2014

Unix interview question - Set 2

1. What is difference between ps -ef and ps -auxwww?  
This is indeed a good Unix Interview Command Question and I have faced this issue while ago where one culprit process was not visible by execute ps –ef command and we are wondering which process is holding the file.
ps -ef will omit process with very long command line while ps -auxwww will list those process as well.  

2. How do you find how many cpu are in your system and there details?
By looking into file /etc/cpuinfo for example you can use below command: cat /proc/cpuinfo

 3. What is difference between HardLink and SoftLink in UNIX?
I have discussed this Unix Command Interview questions  in my blog post difference between Soft link and Hard link in Unix

4. What is Zombie process in UNIX? How do you find Zombie process in UNIX?
When a program forks and the child finishes before the parent, the kernel still keeps some of its information about the child in case the parent might need it - for example, the parent may need to check the child's exit status. To be able to get this information, the parent calls 'wait()'; In the interval between the child terminating and the parent calling 'wait()', the child is said to be a 'zombie' (If you do 'ps', the child will have a 'Z' in its status field to indicate this.)  

Zombie : The process is dead but have not been removed from the process table.

 5. What is "chmod" command? What do you understand by this line “r-- -w- --x?

 6. There is a file some where in your system which contains word "UnixCommandInterviewQuestions”. 
How will find that file in Unix?
By using find command in UNIX for details see here 15 example of using find command in Unix  

7. In a file word UNIX is appearing many times? How will you count number?
grep -c "Unix" filename  

8. How do you set environment variable which will be accessible form sub shell?
By using export   for example export count=1 will be available on all sub shell.  

9. How do you check if a particular process is listening on a particular port on remote host?
By using telnet command for example “telnet hostname port”, if it able to successfully connect then some process is listening on that port. To read more about telnet read networking command in UNIX  

10. How do you find whether your system is 32 bit or 64 bit ?
Either by using "uname -a" command or by using "arch" command.

References

0 comments:

Post a Comment