Unix Interview Questions and Answers

Last updated on Mar 08, 2022
  • Share
Unix Interview Questions

Unix is a stable and secure operating system that is capable of handling commands from multiple users at the same time. The innermost level of the Unix environment, Kernel coordinates the computer internals and allocates all the resources. Users can communicate with the kernel through a program known as a shell, which translates commands written by the user into a language that the kernel can interpret. Want to clear interviews in one shot? Read our Unix interview questions.

Advantages of Unix

  • Each big task can be split into simple commands and utilities
  • Can be used on a variety of machines
  • Can run many programs with less physical memory consumption
  • Multiple users can perform various tasks at the same time without interfering with each other’s work. Each user’s work is protected.
  • Cleanly defined permissions and access for each user for each file.

Most Frequently Asked Unix Interview Questions

Here in this article, we will be listing frequently asked Unix Interview Questions and Answers with the belief that they will be helpful for you to gain higher marks. Also, to let you know that this article has been written under the guidance of industry professionals and covered all the current competencies.

Q11. What is the command to compare two files in UNIX?
Answer
You can use the following commands to compare two files –
  • cmp [options] file1 file2 – compare 2 files character by character
  • comm [options] file1 file2 – compare sorted files
  • diff [options] file1 file2 – compare two files line by line
Q12. How to find out what processes are running in the background in Unix?
Answer

Type the command jobs to see the processes running in the background.

Example

Example – $ jobs give the output as –

[134]+ Running sleep 50 &

where 134 is the job number.

Q13. How do you kill a process in Unix?
Answer

Use the command kill along with the process id (PID) to kill a process.

Example – kill 12323

If this does not destroy the process, add the signal number for a kill to kill the process. Unix cannot ignore the signal number.

Example – kill -9 12323

Continue reading Unix interview questions to know how you can stop an infinite loop using the same command

Q14. What are a shell in Unix and its types?
Answer

Shell is a program that gives us an interface between the Unix OS kernel and user. By this interfacing, the user can execute utilities and applications using the shell. Each user gets a unique shell when he logs in or opens a console. The different shells are Bourne shell (sh), C shell (csh), the Korn shell (ksh), GNU Bourne-Again Shell (bash).

Q15. What is the difference between an absolute path and a relative path in Unix?
Answer
S.no ABSOLUTE PATH RELATIVE PATH
1. the full path starting at the root directory (/). Path in relation to the present working directory as the reference.
2. Example - /home/math/tutorial Access the current directory using the command ‘pwd’. Change the directory using ‘cd’.
Q16. What are system variables in Unix?
Answer

Some system variables set in Unix by default are HOME, USER, HOST, DISPLAY, and PATH. These can be environment variables or local variables enabled by the shell.

Q17. What are pipes and filters in Unix?
Answer
  • Pipes – a pipe connects small commands together to execute a complete complex task. Pipe symbol is ‘|.’ The flow of data through the pipe is from left to right. Example – $ cat names.txt | grep “Sam” | tee sam.txt | wc -1
  • Filter – Filters are used to modify the output of a command. Examples of filters are grep, sort, more, less, cat, cut and so on.
Q18. How to find the path in Unix?
Answer

To find the path, use the command – echo $PATH

Q19. What command is used to switching between users in Unix?
Answer

Use the ‘su’ command to switch between users in Unix.

Syntax – su [options] [username]

Q20. How to check logs in Unix?
Answer

You can check logs in the file syslog located in /etc/syslog.conf

In our list of Unix interview questions, we have covered all the essential aspects of Unix. Read on to know more.

Development History

Unix was developed at AT&T Bell Labs by Ken Thompson and Dennis Ritchie in 1979. The first portable version of Unix was V7. Check out our Unix interview questions list to understand how Unix processes command written by the user.

Latest version

The latest version of Unix is ‎4.20.8 released on 12 February 2019.

Reviewed and verified by Best Interview Question
Best Interview Question

With our 10+ experience in PHP, MySQL, React, Python & more our technical consulting firm has received the privilege of working with top projects, 100 and still counting. Our team of 25+ is skilled in...