General UNIX interview questions with answers



UNIX is an another Operating System like Linux , Windows etc. Here I have collected UNIX interview questions with their answers for your reference. If you require download UNIX Faqs in PDF format.

UNIX is a family of stable multi-tasking, multi-user for desktops, laptops and servers. Like the Microsoft Windows, UNIX systems have a graphical user interface (GUI) which offers an environment that is easy to use.

From the point of view of the user or programmer, Unix systems are typified by a modular design that is occasionally referred to as the “Unix philosophy”, which means that the operating system presents a set of tools that are simple, with each performing a limited, well-defined function, with a unified filesystem as the major way of communication, with a shell scripting and a command language to add the tools together to execute complex workflows.

UNIX interview questions and answers

For anyone preparing to attend a UNIX interview, here are some of the few questions you may likely be asked:

  1. How do you find a process and kill that?

Ans.

If you use the “ps -ef” you get a list of all process and use grep to locate your process and get the PID of that process. After getting the PID you can then make use of the kill command to kill that process.

  1. How do you create an archive file in UNIX or Linux Operating System?

Ans.

An archive can be created in UNIX or Linux by using the tar command you can also create a compressed archive in UNIX by combining tar and gzip

  1. I have read permission on a directory but I am not able to enter it, why?

Ans.

You cannot go into a directory by making use of the cd command if your directory does not have to execute command.

  1. What is the difference between the break and continue, within a UNIX shell scripting?

Ans.

If you use a break within a shell scripting loop construct, it will terminate the entire loop. A continue will terminate the current iteration, but the loop will continue on the next iteration.

  1. How do you debug bash script?

Ans.

Simply add –xv to #!/bin/bash

For instance,

#!/bin/bash –xv

  1. How do you check if file exists on filesystem?

Ans.

If [-f/var/log/messages]

then

echo “File exists”

fi

  1. Provide an example on how to write function

Ans.

Function example {

echo “Hi everyone!”

}

  1. What is Paging?

Ans.

Only required memory pages are moved to main memory for execution

  1. How do you set the path in UNIX?

Ans.

set path = [directory path]

  1. What is tee command?

Ans.

Tee command is used for

  • Sending data from the standard point
  • Sending it to standard output
  1. What are filters?

Ans.

A Filter is a program which filters the data prior to execution on application OR database

  1. What is Shell?

Ans.

A shell operates as a boundary between the user and the system

  1. What is inode?

Ans.

The inode is a data structure in a file system. Each inode is able to store the attributes and the location (s) of the disk block of the object’s data.

  1. What is ephemeral port?

Ans.

Operating systems use Ephemeral ports for client sockets

  1. How do you create readonly file?

Ans.

Use,

touch filename.txt

chmod 400 fileName.txt

 

  • Quick introduction about UNIX OS

    5_What is unix

  • Introduction about the term shell in UNIX

    2_What is a shell

  • Should be thorough about session

    3_Define session

  • Question about Signal in UNIX

    4_What do you mean by signal

  • Question about Message queue

    6_Define message queue

  • Directory and filenaming in UNIX

    7_Define directory and filename

  • Definition of terms program and process

    8_Define program and process

  • Different file types in UNIX

    9_List down the different file types

  • 10_What are the options available to determine the group ID of the new file
  • About sticky bit in UNIX

    11_Define sticky bit

  • Question about page fault

    12_What is called a page fault

  • 13_What do you mean by u-area (user area)
  • Types of buffering in UNIX

    14_What are the different types of buffering is supported by UNIX