Interview Questions | Unix/Linux Administration Questions | Interview Questions



Get "Unix/Linux Administration Questions" Category

Sort by:

Explain the layered aspect of a UNIX system. What are the layers? What does it mean to say they are layers?

A UNIX system has essentially three main layers:

  • The hardware
  • The operating system kernel
  • The user-level programs

The kernel hides the systems hardware underneath an abstract, high-level programming interface. It is responsible for implementing many of the facilities that users and user-level programs take for granted.

Read more on Explain the layered aspect of a UNIX system. What are the layers? What does it mean to say they are layers?…

What does the command œ $who | sort “logfile > newfile do?

The input from a pipe can be combined with the input from a file . The trick is to use the special symbol œ-œ
(a hyphen) for those commands that recognize the hyphen as std input.
In the above command the output from who becomes the std input to sort , meanwhile sort opens the file
logfile, the contents of this file is sorted together with the output of who (rep by the hyphen) and the sorted
output is redirected to the file newfile.

Read more on What does the command œ $who | sort “logfile > newfile do?…

What is a pipe explain with an example?

A pipe is two or more commands separated by pipe char ‘|’. That tells the shell to arrange for the output of the preceding command to be passed as input to the following command.

Read more on What is a pipe explain with an example?…

Explain the steps that a shell follows while processing a command

After the command line is terminated by the key, the shell goes ahead with processing the command line in one or more passes. The sequence is well defined and assumes the following order.

Read more on Explain the steps that a shell follows while processing a command…

What is the significance of the tee Command?

It reads the standard input and sends it to the standard output while redirecting a copy of what it has read to the file specified by the user.
tee
_____________
L/I –> –> R/O
—- | —-
| | |
| V |
| |
D/O
L/I–Left/Input standard input
R/O–Right/Output standard output
D/O–Down/Output Storing in separate file
Syntax:
for ex:

Read more on What is the significance of the tee Command?…

Construct pipes to execute the following jobs

1. Output of who should be displayed on the screen with value of total number of users who have logged in displayed at the bottom of the list.
2. Output of ls should be displayed on the screen and from this output the lines containing the word poem should be counted and the count should be stored in a file.
3. Contents of file1 and file2 should be displayed on the screen and this output should be appended in a file. From output of ls the lines containing poem should be displayed on the screen along with the count.
4. Name of cities should be accepted from the keyboard . This list should be combined with the list present in a file. This combined list should be sorted and the sorted list should be stored in a file newcity.
5. All files present in a directory dir1 should be deleted any error while deleting should be stored in a file errorlog.

Read more on Construct pipes to execute the following jobs…

How can I set a cron and how can I execute it in Unix, Linux, and windows?

Cron is very simply a Linux module that allows you to run commands at predetermined times or intervals. In Windows, it’s called Scheduled Tasks. The name Cron is in fact derived from the same word from which we get the word chronology, which means order of time.
The easiest way to use crontab is via the crontab command.

Read more on How can I set a cron and how can I execute it in Unix, Linux, and windows?…

What is a pipe and give an example?

A pipe is two or more commands separated by pipe char ‘|’. That tells the shell to arrange for the output of
the preceding command to be passed as input to the following command.

Read more on What is a pipe and give an example?…

Explain kill() and its possible return values

There are four possible results from this call:
˜kill() returns 0. This implies that a process exists with the given PID, and the system would allow you to
send signals to it. It is system-dependent whether the process could be a zombie.
˜kill() returns -1, ˜errno == ESRCH either no process exists with the given PID, or security enhancements
are causing the system to deny its existence. (On some systems, the process could be a zombie.)
˜kill() returns -1, ˜errno == EPERM the system would not allow you to kill the specified process. This means that either the process exists (again, it could be a zombie) or draconian security enhancements are present (e.g. your process is not allowed to send signals to *anybody*).
˜kill() returns -1, with some other value of ˜errno you are in trouble! The most-used technique is to assume that success or failure with ˜EPERM implies that the process exists, and any other error implies that it doesn’t.
An alternative exists, if you are writing specifically for a system (or all those systems) that provide a ˜/proc
filesystem: checking for the existence of ˜/proc/PID may work.

Read more on Explain kill() and its possible return values…

Explain kill ( ) and its possible return values

There are four possible results from kill():

  • kill( ) returning 0. This implies that a process exists with the given PID, and the system would allow you to send signals to it. It is system-dependent whether the process could be a zombie.

Read more on Explain kill ( ) and its possible return values…

What is a Zombie process ?

When using fork() to create child processes it is important to keep track of these processes. For instance, when a child process terminates, an association with the parent survives untill the parent either terminates normally or calls wait().

Read more on What is a Zombie process ?…

Explain the steps that a shell follows while processing a command

After the command line is terminated by the key, the shel goes ahead with processing the command line in
one or more passes. The sequence is well defined and assumes the following order.

Read more on Explain the steps that a shell follows while processing a command…