20 Unix Interview Questions & Answer

20 Unix Interview Questions & Answer

How to be best prepared for an interview on UNIX

You may be preparing for a UNIX Interview. If you are then you ought to be set up for the meeting with the objective that you can rouse the examiner most. The primary concern that you need to do is to be set up with some unix interview questions. There are some extraordinary things too that you ought to be set up with before you arrange yourself in the hot seat anyone would want to be. By examining the request you will have the ability to appreciate what nature of request you can be asked and what may be the correct answer if you are asked such a question. There are diverse plans in like manner that you need to make before you go for a meeting. You need to mastermind the travel unpretentious components of yours suitably. The travel should be wanted to the point that you don’t be late for the meeting. It is perfect to accomplish the scene of the meeting to some degree in front of a timetable than to be late. The accompanying thing is not to be scared at any condition. You may not make certain about a question. If it so happens then it is required that your venture to think of it and after that answer. If you can’t recollect the suitable reaction, it is perfect to tell the examiner that you don’t have the foggiest thought regarding the proper reaction than to give a wrong answer. Act naturally in the midst of the meeting. Make an effort not to endeavour to copy others. You ought to concentrate on your non-verbal correspondence. You ought to have an eye contact with the examiner it will help you to have some assurance. By and by, as you understand what to do before and in the midst of the meeting let us see a segment of the request that you may be asked.

What is UNIX?

This may be the first question that you are asked from the set of unix interview questions. The questions that you are asked may seem to be very basic and that is really what the interviewer wants to ask. They want to gauge the depth of knowledge that you have regarding UNIX. It is better to have the answers prepared for these basic questions so that we do not falter while answering them.

Coming back to the question the answer to this question is that UNIX is an operating system which is portable in nature and can be used for efficient multitasking and used by various functions which are used by many users. As the nature of this operation system is portable it can be efficiently used on various hardware platforms.

What are filters?

This term is frequently used for referring to any program which can take input from various standard input and do some nature of operations upon that input. After the operation is completed it also has the ability to write the result to the standard output. It is also a nature of the program that can be used in-between two different programs.

Tell the syntax that is followed while issuing commands in shells?

The syntax that is followed while issuing commands under the UNIX shell is

Command [-argument] [-argument] [-argument] [file]

So, you can see that you need to be prepared with all sorts of unix interview questions. You may even be handed over a paper where you have to write codes like that above. So, through preparation is required if you really wish to crack the interview and be the one who is selected for the job.

Tell the key features which are there in Korn Shell?

The key features that are there in Korn Shell are:

  • history mechanism which has built-in editor which can simulate emacs or vi
  • integer arithmetic which is built-in
  • capabilities to perform string manipulation
  • aliasing of command
  • arrays
  • control of job

Tell about the common shells and their indicators?

  • sh – Bourne shell
  • csh – C Shell
  • bash – Bourne Again Shell
  • tcsh – enhanced C Shell
  • zsh – Z Shell
  • ksh – Korn Shell

These are the common shells and their indicators.

Explain what you know about Kernel?

This is the UNIX working framework. It is the ace program that controls the PC’s assets, have the power to allocate them to various clients and to various undertakings. In any case, the Kernel doesn’t bargain specifically with a client. Rather, it begins up a different, intuitive program, called a shell, for every client when he/she sign on.

What do you understand by command substitution?

When a command is processed by a shell this is one of the process that is followed. The commands which are written within a backquote are those which are performed by the shell. They will then replace the outputs which are standard of the command and they will be displayed on the line of the command.

You may be looking that the questions asked are basically those which begins with why and how. These are the types of questions that you must be prepared with. The basic objective of the interviewer is to judge whether you know them properly so that you can apply those in practical field.

What are the responsibilities of Shell?

There are various responsibilities which are performed by a Shell. The responsibilities are:

  • Execution of program
  • Name substitution of variable and file
  • Redirection of I/O
  • Hookup of pipeline
  • Control of environment
  • Programming language interpretation

Explain the difference between system call, library function and UNIX command?

Obviously, this answer is known to you. But then also it is good to refresh your memory ones and to organise the answer so that we can speak as the question is asked.

The answer to this question is that:

System Call: It is a part of the programming that is used by Kernel.

Library function: This is not a part of the Kernel but they are accessible to the users who use the system.

UNIX command: These are programs which are stand-alone in nature and it can have both system call and library function integrated in the programming that it uses.

What are most frequently used network commands in UNIX?

The most frequently used network commands in UNIX are:

  • telnet – It is the command that is used for logging remotely
  • ping – It is an echo request that is used for testing connectivity
  • su – The command that is used for switching user
  • ftp – This is a file transfer protocol which is used for copying files
  • finger – This is the command that is used for gathering information.

What is the difference between cmp command and diff command?

The cmp command is used for matching two files byte by byte and displaying the mismatch that is found. Whereas, diff command is used for showing the changes which have to be undertaken so that two files can be made similar to one another.

How can you determine the path and set it in UNIX?

Every time a command is entered by you a variable which is called PATH will establish the directory where the shell would search for having that command. In some cases, an error message is displayed this happens when the command is not included in the path that is presented to you. It may also be that the command does not exist at all. Manually the path can be set by one using the command “setpath=[directory path]”

Is it conceivable to see data about a procedure while it is being executed?

Each procedure is particularly recognized by a procedure identifier. It is conceivable to view subtle elements and status with respect to a procedure by utilizing the ps command.

Tell what you know about IPC? Explain the various schemes that are available?

The term IPC (Inter-Process Communication) portrays different routes by which diverse process running on some working framework impart between each other. Different plans accessible are as per the following:

  • Pipes: One-way correspondence conspires through which distinctive process can impart. The issue is that the two procedures ought to have a typical precursor (parent-tyke relationship). However this issue was settled with the presentation of named-pipes (FIFO).
  • Message Queues: Message Queues can be utilized amongst related and irrelevant procedures running on a machine.
  • Shared Memory: This is the speediest of all IPC plans. The memory that is to be shared is mapped into the address space of the procedures (that are sharing). The speed accomplished is ascribed to the way that there is no kernel inclusion. In any case, this plan needs synchronization.

Different types of synchronization are mutexes, condition-variables, read-write locks, record-locks, and semaphores.

Explain the difference that is there between Swapping and Paging?

Swapping:  Entire process is moved from the swap gadget to the principle memory for execution. Process measure must be not exactly or equivalent to the accessible primary memory. It is less demanding to usage and overhead to the framework. Swapping frameworks does not deal with the memory all the more with flexibility when contrasted with the paging frameworks.

Paging: Just the required memory pages are moved to primary memory from the swap gadget for execution. Process measure does not make a difference. Gives the idea of the virtual memory.

It gives more prominent adaptability in mapping the virtual address space into the physical memory of the machine. Enables more number of processes to fit in the primary memory all the while. Permits the more prominent process estimate than the accessible physical memory. Request paging frameworks handle the memory all the more flexibly.

So, you can easily see what nature of question you may be asked while seat for these interviews. The unix interview questions may be mixed and the interviewer may not give you enough time to think and answer. If you fumble it will show the lack of knowledge that you have to the interviewer. So, even if you think that these natures of questions are known to you it is better to go through them once so that there will no chance of fumbling while you are asked such. We will be discussing some more questions which will help you to be fully prepared for such interview and be the one who is selected for the job.

State the states that pages may be in after there is page fault?

The states that pages can be after a page fault are:

  • They can be on a swap device and not in memory,
  • The pages can be on the list of free page that is there in the main memory,
  • They can be in a file which is executable
  • The pages can be marked “demand zero”
  • They can also be marked as “demand fill”.

What is the fault that a page is checked first?

Validity fault is the fault that a page is checked for when it is seen that the page is invalid. The validity fault handler is returned instantaneously and the process incurs the page default validity. The validity fault is taken care by the Kernel and Protection fault is taken care by the process.

What leads to a deadlock when swapping is done to a process?

The conditions which may lead to a deadlock are:

  • If it is that all processes that is there in the main memory are asleep.
  • All the processes which are ‘ready-to-run’ are swapped out.
  • There is less space present in the swap device for adjusting the process which is swapped away from main memory.
  • The main memory does not have any space so that it can adjust the new process.

Mention the data structures that are required for Demand Paging?

There are four types of data structure in Kernel for demand paging. They are:

  • Page table entries,
  • Disk block descriptors,
  • Page frame data table (pfdata),
  • Swap-use table.

Explain the main goal of having Memory Management?

The main goal of having Memory Management is:

  • It is which that decides which process should be included in the main memory.
  • This is what which manages the various parts of the virtual address space which is of nature non-core resident.
  • It is that which monitors the main memory and it is one which writes the processes periodically to the swap device so that more process can fit into the memory.

What are the system calls that are used by I/O?

  • open(pathname,flag,mode) – open file
  • creat(pathname,mode) – create file
  • close(filedes) – close an open file
  • read(filedes,buffer,bytes) – read data from an open file
  • write(filedes,buffer,bytes) – write data to an open file
  • lseek(filedes,offset,from) – position an open file
  • dup(filedes) – duplicate an existing file descriptor
  • dup2(oldfd,newfd) – duplicate to a desired file descriptor
  • fcntl(filedes,cmd,arg) – change properties of an open file
  • ioctl(filedes,request,arg) – change the behaviour of an open file

Explain how you change the permission for File access?

Every file has following attributes:

  • owner’s user ID ( 16 bit integer )
  • owner’s group ID ( 16 bit integer )
  • File access mode word

‘r w x -r w x- r w x’
(user permission-group permission-others permission)
r-read, w-write, x-execute
chmod is used for changing the mode of access. (filename,mode).

Example 1:
To change mode of myfile to ‘rw-rw-r–‘ (ie. read, write permission for user – read,write permission for group – only read permission for others)  we give the args as:
chmod(myfile,0664) .
Each operation is represented by discrete values
‘r’ is 4
‘w’ is 2
‘x’ is 1
Therefore, for ‘rw’ the value is 6(4+2).

Example 2:
To change mode of myfile to ‘rwxr–r–‘ we give the args as:
chmod(myfile,0744).

So, we can now say that these are the questions which are generally asked in an interview on UNIX. It is good that you have this set with you. Start preparing now and do not waste any time. It is good if you go through the questions more than once so that they get imprinted in your mind. I do not suggest memorizing them but reading along a number of times will help you a lot in to be successful in the interview.

It must be said that there is instability related with meetings yet in the event that you can ensure that you finish your work legitimately before going for a meeting you will be able to face that with more confirmation. Never show your uneasiness or disarray to the inspector. They may mix the words in such a course, to the point that reasonable demand may have every one of the reserves of being troublesome. Keep an accumulated identity and consider the question and a while later answer that. It can without a lot of clarification be said that you know all as to UNIX along these lines, you can answer any of the unix interview questions that are heaved at you by the interviewer.

Leave a Reply

Close Menu