Saturday, July 26, 2014

Unix Interview questions - Set 3

1. How do you find which processes are using a particular file?
By using
command in UNIX. It wills list down PID of all the process which is using a particular file.  

2. How do you find which remote hosts are connecting to your host on a particular port say 10123?
 By using netstat command execute
netstat -a | grep "port" 
and it will list the entire host which is connected to this host on port 10123.  

3. What is nohup in UNIX?
As mentioned here :
The nohup command runs the command specified by the Command parameter and any related Arg parameters, ignoring all hangup (SIGHUP) signals or modifies the process specified with -p option to ignore all hangup (SIGHUP) signals.

The nohup command can also be used to run programs in the background after logging off. To run a nohup command in the background, add an & (ampersand) to the end of the command.
Note: pid and Command can not be specified together. When -p pid is used, the output of the specified process will not be re-directed to nohup.out.

4. What is ephemeral port in UNIX?
Ephemeral ports are port used by Operating system for client sockets. There is a specific range on which OS can open any port specified by ephemeral port range.
5. If one process is inserting data into your MySQL database? How will you check how many rows inserted into every second?
Purpose of this Unix Command Interview is asking about "watch" command in UNIX which is repeatedly execute command provided with specified delay.
6. There is a file Unix_Test.txt which contains words Unix, how will you replace all Unix to UNIX?
You can answer this Unix Command Interview question by using SED command in UNIX for example you can execute  
sed s/Unix/UNIX/g fileName

7. You have a tab separated file which contains Name, Address and Phone Number, list down all Phone Number without there name and Addresses?
 To answer this Unix Command Interview question you can either you AWK or CUT command here. CUT use tab as default separator so you can use
cut -f3 filename.

8. Your application home directory is full? How will you find which directory is taking how much space?
By using disk usage (DU) command in Unix for example
du –sh . | grep  
will list down all the directory which has GIGS in Size.

9. How do you find for how many days your Server is up?
By using uptime command in UNIX  

10. You have an IP address in your network how will you find hostname and vice versa?
This is a standard UNIX command interview question asked by everybody and I guess everybody knows its answer as well. By using nslookup command in UNIX, you can read more about Convert IP Address to hostname in Unix here.




Post a Comment