Unix Engineer Interview Questions

Explain about File modes in UNIX?

With the aid of UNIX, users can be able to customize their desired level of privacy. Access permission for files can also be set by the user and these types of file management is called as File modes. File permission access can be assigned based on the following three categories of users,

Owner – original creator of the file

Group – Users those who have the same access permission as the original user

Others – rest of the users

File format

drwxrwxrw filename date time

Where,

d- Directory

r- Read

w- Write

x- Execute

 

List the various ways to redirect I/O

UNIX redirection operation has been a great advantage to the users where, instead of sending the output directly to your screen, you can make use of redirection facility. The redirection operation can be performed using the redirection pointer (> & >>). Here are the various ways of redirecting I/O,

Concatenation of multiple files

Appending one file to another file

Copying the contents of one file to another file

Redirecting the input to a file instead of keyboard

 

How do you classify super block in UNIX?

Superblocks are classified into two types such as Default Super block and Redundant Super block.

Default Super block

One can able to find the default super block at the beginning of system’s disk partition and it will be at fixed offset by default.

Redundant Super block

In the case where default super block is affected by some errors or system crash, the redundant super block will be referenced.

 

Explain the difference between multi-tasking and multi-user.

The difference between, multi-tasking and multi-user is very simple. When a user runs multiple tasks simultaneously in a single machine, then it is said to be multi-tasking. In a single machine, if more than one user work then it is said to ne multi-user.

 

Explain the following commands : head -3 test.txt and sed ‘4,$ d’ test.txt

head -3 test.txt

The ‘head’ command and the ‘-3’ parameter together point the total number of lines that has to be displayed.

sed ‘4,$ d’ test.txt

To perform the task, this command uses Sed text editor. In order to display the whole text, simply the command, ‘sed test.txt’ can be used. But in the above given command, the delete parameter (d) was used to delete the lines between the 4th and the last line which is defined by the $ parameter. This in turn leaves only the first three lines of the file. It is mandatory to mention the literal function of Sed that it does not delete the lines from the files itself rather it trashes only from the output result.