Top 35 Unix Interview Questions: Here are the top interview questions of Unix. Be prepared for the interview. You can download the entire questions in a pdf format. so guys All the best for your interview.
1) What is Unix?
UNIX is a portable operating system that is designed for efficient multitasking and multi-user functions. Since it is a portable operating system, it can run on different hardware platforms. It is written in C language. It was developed by Ken Thompson, Dennis Ritchie, Douglas McIlroy, and Joe Ossanna.
2) List the distributions of UNIX.
UNIX has many distributions including Solaris UNIX, AIX, HP UNIX and BSD and many more.
3) List some features of UNIX.
UNIX includes the following features:
UNIX supports the multiuser system: In UNIX it is possible that many users can use the system with their separate workspace and logins i.e.it has full support for the multiuser environment.
UNIX supports the multitasking environment: In UNIX many apps can run at a single instance of time this is also known as a multitasking environment.
4) What are the core concepts of UNIX
The core concepts of UNIX are given below.
- Kernel- The kernel is also known as the heart of the operating system. Its fundamental role is to interact with the hardware and also monitor major processes like memory management, file management, and task scheduling.
- Shell- It is also called command prompt, it connects the user to the operating system, whatever is typed by the user is translated into the language understood by the command prompt, and then the corresponding actions are performed.
- Commands and Utilities- Many built-in commands help the user perform day to day activities.mv,cat,cp,and grep etc. Some of the examples
- Directories- Every bit of data is stored in files, and these files are stored in directories, these directories combine to form a tree-like structure.
5) What is a UNIX shell?
Top 35 Unix Interview Questions The UNIX shell is a program which is used as an interface between the user and the UNIX operating system. It is not a part of the kernel, but it can communicate directly with the server.
6) What is Kernel?
The kernel is the UNIX operating system is the master program that controls the computer’s resources, allotting them to different users and performing different tasks. However, the kernel doesn’t deal directly with a user. Instead, it starts up a separate, interactive program, called a shell, for each user when he/she logs on.
7) What is Shell?
A shell acts as an interface between the user and the system. As a command interpreter, the shell takes commands and sets them up for execution.
8 ) What are the key features of the Korn Shell?
- history mechanism with a built-in editor that simulates emacs or vi
- built-in integer arithmetic
- string manipulation capabilities
- command aliasing
- job control
9) What are some common shells and what are their indicators?
- sh – Bourne shell
- csh – C SHell
- bash – Bourne Again Shell
- tcsh – enhanced C Shell
- zsh – Z SHell
- ksh – Korn SHell
10) Differentiate multiuser from multitask.
Top 35 Unix Interview Questions Multiuser means that more than one person can use the computer at the same time. Multitask means that even a single user can have the computer work on more than one task or program at the same time.
11) Write down some common shells with their indicators?
- sh – Bourne shell
- csh – C Shell
- bash – Bourne Again Shell
- tcsh – enhanced C Shell
- zsh – Z Shell
- ksh – Korn Shell
12) What are the main features of Korn Shell?
- Job control
- Command Aliasing
- String manipulation ability
- Built-in integer arithmetic
13) What is the difference between cat command and more command?
The cat command is used to display the file contents on the terminal, whereas more command is used like a pager which displays the screen page by page If the file is large and you have to scroll off the screen before you view it.
14) Which command is used to restrict incoming messages?
The “mesg” command is used to restrict incoming messages.
15) Which command is used to kill the last background job?
The “kill $!” Command is used to kill the last background job.
16) Differentiate relative path from an absolute path.
Relative path refers to the path relative to the current path. An absolute path, on the other hand, refers to the exact path as referenced from the root directory.
17) Explain the importance of directories in a UNIX system
Files in a directory can be a directory itself; it would be called a subdirectory of the original. This capability makes it possible to develop a tree-like structure of directories and files, which is crucial in maintaining an organizational scheme.
18) Briefly describe the Shell’s responsibilities
- program execution
- variable and file name substitution
- I/O redirection
- pipeline hookup
- environment control
- interpreted programming language
19) What are shell variables?
Shell variables are a combination of a name ( identifier), and an assigned value, which exists within the shell. These variables may have default values, or whose values can be manually set using the appropriate assignment command. Examples of shell variable are PATH, TERM, and HOME.
20) What are the differences among a system call, a library function, and a UNIX command?
Top 35 Unix Interview Questions A system call is part of the programming for the kernel. A library function is a program that is not part of the kernel but which is available to users of the system. UNIX commands, however, are stand-alone programs; they may incorporate both system calls and library functions in their programming.
21) How to list directories in UNIX?
Command ls can be used to list directories in command prompt. Also, we can also use a variety of ls commands like:
In Linux, hidden files start with. (dot) Symbol and they are not visible in the regular directory. The (ls -a) command will enlist the whole list of the current directory including the hidden files.
It will show the list in a long list format.
This command will show you the file sizes in human readable format. Size of the file is tough to read when displayed regarding a byte. The (ls -lh)command will give you the data regarding Mb, Gb, Tb, etc.
If you want to display your files in descending order (highest at the top) according to their size, then you can use (ls -lhS) command.
ls -l - -block-size=[SIZE]
It is used to display the files in a specific size format. Here, in [SIZE] you can assign size according to your requirement.
ls -d */
It is used to display only sub directories.
ls -g or ls -lG
With this, you can exclude column of group information and owner.
It is used to print group ID and owner ID instead of their names.
This command is used to print list as colored or discolored.
This command prints the index number if the file in the first column.
It is used to identify the directory easily by marking the directories with a slash (/) line sign.
It will display the content of the sub-directories also.
It will group the files with the same extensions together in the list.
It will sort the list by displaying a recently modified file at the top.
It gives the contents of the home directory.
It gives the contents of the parent directory.
It checks the version of ls command.
22) How to check the date in UNIX?
To display the date in UNIX use the date command in command prompt.
23) How to log out in UNIX?
To log out of UNIX type the logout command in the command prompt.
24) How to perform a system shutdown in UNIX?
To perform system shutdown in UNIX, you can use the following commands:
- init 0
- init 6
- power off
25) How many types of files are there in UNIX?
There are three kinds of files in UNIX:
- Ordinary files: An ordinary file is the one which contains data, text or program instructions.
- Directories: These include both ordinary files and special files.
- Special Files: These are the files which provide unique access to hardware such as hard drives, CD-Rom Drives e.t.c.
26) What is a superuser?
Top 35 Unix Interview Questions A superuser is a special type user who has open access to all files and commands on a system. Note that the superuser’s login is usually root, and is protected by a so-called root password.
27) How do you determine and set the path in UNIX?
Each time you enter a command, a variable named PATH or path will define in which directory the shell will search for that command. In cases wherein an error message was returned, the reason may be that the command was not in your path, or that the command itself does not exist. You can also manually set the path using the “set path = [directory path]” command.
28) Is it possible to see information about a process while it is being executed?
Every process is uniquely identified by a process identifier. It is possible to view details and status regarding a process by using the ps command.
29) What is the standard convention being followed when naming files in UNIX?
One important rule when naming files is that characters that have special meaning are not allowed, such as * / & and %. A directory, being a special type of file, follows the same naming convention as that of files. Letters and numbers are used, along with characters like underscore and dot characters.
30) Why is it that it is not advisable to use root as the default login?
The root account is very important, and with abusive usage, can easily lead to system damage. That’s because safeguards that normally apply to user accounts are not applicable to the root account.
31) How to create a blank file in UNIX?
Blank files can be created by using the touch command, the syntax for the touch command is as follows:
$ touch filename
32) How to know the present working directory in UNIX?
To know the present working directory, Run the following command on the terminal.
33) How to know the information about a file?
To fetch the information about a file, use the following command.
$ file filename
34) How to change the directory in UNIX?
Top 35 Unix Interview Questions To change the directory, you can use the cd command in the terminal window. It changes the current directory to the specified directory.
$ cd directory-name
35) How to move files from one directory to other in UNIX?
In UNIX, mv command is used to move the file from one directory to some other directory.
$ mv <file-name> <destination path>