UNIX Flashcards
Write command to list all the links from a directory?
In this UNIX command interview questions interviewer is generally checking whether user knows basic use of “ls” “grep” and regular expression etc
You can write command like:
ls -lrt | grep “^l”
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.
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
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
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.
What is “chmod” command? What do you understand by this line “r– -w- –x?
The chmod (abbreviated from change mode) is a Unix command that lets a user tell the system how much (or little) access it should permit to a file.
There is a file some where in your system which contains word “UnixCommandInterviewQuestions” How will find that file in Unix?
Find command with many options.
In a file word UNIX is appearing many times? How will you count number?
grep -c “Unix” filename
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.
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.
Create a read-only file in your home directory?
This is a simple UNIX command interview questions where you need to create a file and change its parameter to read-only by using chmod command you can also change your umask to create read only file.
touch file
chmod 400 file
read more about file and directory permission in unix and linux here.
How will you find which operating system your system is running on in UNIX?
By using command “uname -a” in UNIX
How will you run a process in background? How will you bring that into foreground and how will you kill that process?
For running a process in background use “&” in command line. For bringing it back in foreground use command “fg jobid” and for getting job id you use command “jobs”, for killing that process find PID and use kill -9 PID command.
This is indeed a good Unix Command interview questions because many of programmer not familiar with background process in UNIX.
How do you know if a remote host is alive or not?
You can check these by using either ping or telnet command in UNIX. This question is most asked in various Unix command Interview because its most basic networking test anybody wants to do it.
How do you see command line history in UNIX?
Very useful indeed, use history command along with grep command in unix to find any relevant command you have already executed. Purpose of this Unix Command Interview Questions is probably to check how familiar candidate is from available tools in UNIX operation system.