Coding Tag provides a comprehensive list of Top 30 Unix questions and answers to crack UNIX interview. The following article contains the compiled collection of Unix shell scripting interview questions including basic concepts that recruiter wants.
1) Name the components of UNIX operating system and role of kernel in UNIX?
The kernel is known as the central core of the UNIX operating system that allocates memory and time to control the programs, resource allocation and manage the file storage and interaction between system calls. The kernel controls everything that occurs in the system.
2) What are the essential features of UNIX?
* Background processors
* Pipes and filters
* Unix shells
* Hierarchical file system
* Development tools
* Multi-user operations
* Use of files as abstractions of devices
* Programming interface
* Built-in networking
3) What are the different commands used for file comparison?
Cmp and Diff are used for file comparison. Cmp is used to display the first mismatch by comparing two files with the byte to byte and Diff is used to display modification required to make two file identical.
4) Suppose we want to change the ownership of our file which command can be used?
5) Suppose anyone wants to create a zip file using the filename given in the same directory. which commands can be used?
6) Give a syntax to kill a process in UNIX?
7) Which command is used to make a new directory in UNIX?
8) Which UNIX command is used to check the remote host is alive or not?
Telnet or ping command can be used
9) Which command in UNIX can be used to displays all the files in the current directory?
10) List some basic networking command used in UNIX?
|su||user switching command|
|xtraceroute||determines the response time and number of hoops needed to reach the network host|
|netstat||information of ongoing network connection on the local system and ports, interfaces statistics routing tables, statistics etc|
|ping||network connectivity checking|
|telnet||remote login and to communicate with another hostname|
|hostname||resolves domain name and IP address|
11) Which command is used in connection with pipes and filters?
12) What do you mean by hidden files in UNIX?
Hidden files are the directories and files that start with â.â. Is-a command is used to show hidden files.
13) Name the command used to list links from the directory?
Is -1rt/grep "^1"
14) If an interviewer asks you which command can be used if you want to copy file from one host to another?
This answer includes many options such as scp, rsync or sftp command
15) If anyone wants to check how much space is left in currently drive F, How can it be checked?
16) How can you check your system is 64 bit or 32 bit?
You can check by using any of the following two commands:
"uname âa" or "arch"
17) Which command can be used if we want to know that about specific file used by which process?
Isof command can be used to list PID of the processes.
18) What do you mean by ephemeral port?
This port is used for client sockets by the operating system and also referred as a short-lived endpoint to request available user port. Operating system picks up the port number from predefined range and releases it after TCP connection termination.
19) This question is a very basic question asked by the recruiter that how you can know about the detail of the data inserted in your MySQL database?
20) Define inode?
Each file in UNIX are given a unique number for identification is known as an inode, with the use of this unique number, the file information such as group, access, and ownership can be obtained. The inode of the specific file can be viewed with the use of the following command
21) What do you mean by Bourne Shell?
Bourne shell is referred to as the original shell or command line processor for scripting. The default shell prompt is â$â character.
Following are the main features of the Bourne shell:
* Interpretation and execution of the user-defined commands
* Use of shell variable
* Filename abbreviation, meta character usage
* Use of inbuilt command set to create programs.
* Redirect input/output
22) What do you mean by zombie process?
The zombie process is known as a defunct process usually found in the program containing parent-child functions. When the child function has completed its execution, it tries to notify its parent function. The state of the child function while waiting for the parent function to receive the exit status and acknowledge it is known as the zombie process.
This process has executed but not exited completely because some of its entries are in the process table.
23) What do you mean by Korn Shell in UNIX?
Korn shell is known as the command execution shell program act as an extension to the Bourne Shell
Following are the key features of Korn Shell
* Enforce command line editing
* Contain debugging primitives to assist the programmers to debug code of their shell
* Support additional flow control structures
* Control command history to permit users to verify the last command executed
* Ability to use aliases, arithmetic expressions, and arrays
24) What is the main role of more command?
This command is used to display file contents one screen page at a time
25) nohup Command?
A nohup is a special Unix command that is used to run background process and another command while suppressing the action of the HUP (hangup) signal
26) How can we restrict incoming message in Unix?
With the use of 'mesg' command
27) List the different process states of UNIX OS?
28) What do you mean by "nice command" used in Unix?
Using a nice command, the priority of a process can be set or control. These priority value can be returned by the nice(). The nice value of one process is independent of another processes nice value. The administrator is permitted to access this nice value.following is the equation used for nice value:
Priority = ("recent CPU usage"/ constant) + (base- priority) + (nice value)
29) Difference between vfork() and fork()?
|This system call is faster||Slower|
|Copy of the parent process's address space is made by the kernel to attach to the child process||No such copy is made by the kernel|
30) Which command is used to make Unix script file executable?