Unix interview questions

Unix is a operating system developed by a group of employees of AT&T during early's 70s, if you are looking for Unix Interview Questions both if you are a interviewer or an applicant, then this web site is ideal for you, take a look at this compilation and extract a lot of common questions about Unix.

Unix interview questions and answers

Unix interview questions

What is Unix?

Besides being an operating System, Unix is a multi-tasking and multi-user operating system, nowadays there are some very successful commercial products that are based on Unix, among them; Solaris, Linux and NetBSD.

Name some Unix characteristics.

Among the most important ones we have:

  • Is a multi user operating system, able to simulate multitasking.
  • Is written on C programming language.
  • Allows communication between processes.
  • Uses a data hierarchical system.

What is the function of a semaphore on Unix?

The function of the semaphores is: Create mutual exclusion. It means that it allows the resources to be used by critical regions of processes, it allows correct synchronization between two or more asynchronous processes.

Explain the Unix kernel

The kernel is the core of Unix, it starts when the operating system boots, and basically controls allocation of devices, CPU and memory.

How do you know if a remote host is alive or not in Unix?

Using the command "ping" or "telnet".

How do you check how much space is left on current hard drive?

Quite simple, using the command "df –h".

How can you count on a file the times that "Unix" appears?

grep -c "Unix" filename

Which command would you use to find which processes are using a particular file?

The command lsof

How do you see the command history?

By using the command "history"

How to print the first line of a file.

Of course this is not the only way to do this task, but is very simple:

$> head -1 file.txt

Name and explain the process states in Unix.

There are 4 states:

  • Running: The process is running, or ready to run.
  • Waiting: The process is waiting for something to run, it can be an event or a resource.
  • Stopped: The processed has been stopped.
  • Zombie: The process is dead, but still exist on the processes table.

What happens when you execute a program in Unix?

The system creates a special environment to run the program, it contains everything the program needs as there were no other programs, the steps are:

  • Assign a slot in the process table.
  • Assign a unique process ID.
  • Copy the parent's context.
  • Return the new process identifier to the parent so it takes control over it.

What is the objective of the memory management?

Decide the processes that should be in the main memory, monitors the available memory and manage the free space to fit more processes into the main memory.

Which processes are not bothered by the swapper?

Zombie processes and processes which process region is being updated by processes locked in memory.

What is the nice value?

Is the value that controls the increment and decrement of the priority of processes, it can be provided only by the administrator and the nice value of a process do not affect the nice value of others.

Which are the two paging states for a page in memory?

The page is not eligible for swapping yet and is aging.

The page is eligible for swapping but not for being reassigned to another virtual address space.

Explain the difference between cmp and diff commands

CMP compares two files byte by byte, and shows the first mismatch, DIFF shows the changes needed to make them identical.

What is a map?

A map is basically and array, it contains free space's addresses, and also the number of available resources there.

What is SHELL?

Is an interface that allows the user to enter commands, and these are converted into operating system calls.

Why would execute a process in background?

To not have to wait for the process to complete, that way you can do something else. You just have to put the symbol & at the end of the command.

What is page fault and which are its types?

A page fault is the situation when a process references a page and you do not have it in the memory, the types are:

  • Validity fault.
  • Protection fault.

Write the command to kill the last background process.

Kill $!

There are too many other Unix interview questions, so remember to review the company's Unix requirements to focus on the correct questions, the same goes for interviewers, take a look at your real requirements and choose the questions that will help you to find the correct person.