21 Most Frequently Asked Basic Unix Interview Questions and Answers
Here is the list of most frequently asked basic unix interview questions and answers. There unix interview questions are very basic and based upon unix shell scripting and common unix commands which are frequently used by any unix user.
1. What is UNIX?
It is a portable operating system that is designed for both efficient multi-tasking and mult-user functions. Its portability allows it to run on different hardware platforms. It was written is C and lets user do processing and control under a shell.
2. 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.
- history mechanism with built-in editor that simulates emacs or vi
- built-in integer arithmetic
- string manipulation capabilities
- command aliasing
- arrays
- job control
- built-in integer arithmetic
- string manipulation capabilities
- command aliasing
- arrays
- job control
4. 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
csh – C SHell
bash – Bourne Again Shell
tcsh – enhanced C Shell
zsh – Z SHell
ksh – Korn SHell
5. What is shell scripting in UNIX?
Shell scripting is used to program command line of an operating system. Shell Scripting is also used to program the shell which is the base for any operating system. Shell scripts often refer to programming UNIX. Shell scripting is mostly used to program operating systems of windows, UNIX, Apple etc. Also this script is used by companies to develop their own operating system with their own features.
6. What is a typical syntax being followed when issuing commands in shell?
Typical command syntax under the UNIX shell follows the format:
Command [-argument] [-argument] [--argument] [file]
Command [-argument] [-argument] [--argument] [file]
7. What is command substitution?
Command substitution is one of the steps being performed every time commands are processed by the shell. Commands that are enclosed in backquotes are executed by the shell. This will then replace the standard output of the command and displayed on the command line.
8. What is a directory?
Every file is assigned to a directory. A directory is a specialized form of file that maintains a list of all files in it.
9. What is history command in UNIX?
We use history command along with grep command in unix to find any relevant command you have already executed.
10. How do you copy file from one host to other?
By using "scp" command. You can also use rsync command to answer this UNIX interview question or even sftp would be ok.
11. How do you find which process is taking how much CPU?
By using "top" command in UNIX.
12. How do you check how much space left in current drive?
By using "df" command in UNIX. For example "df -h ." will list how full your current drive is.
13. How do you know if a remote host is alive or not?
You can check these by using either ping or telnet command in UNIX.
14. How will you run a process in background? How will you bring that into foreground and how will you kill that process?
For running a process in background use "&" in command line. For bringing it back in foreground use command "fg jobid" and for getting job id you use command "jobs", for killing that process find PID and use kill -9 PID command.
15. How will you find which operating system your system is running on in UNIX?
By using command "uname -a" in UNIX
16. What is the command to list all the links from a directory?
You can answer command like: ls -lrt | grep "^l"
17. How will you create a read-only file in your home directory?
You need to create a file and change its parameter to read-only by using chmod command you can also change your umask to create read only file.
touch file
chmod 400 file
touch file
chmod 400 file
18. What is the difference between Swapping and Paging?
Swapping:Whole process is moved from the swap device to the main memory for execution. Process size must be less than or equal to the available main memory. It is easier to implementation and overhead to the system. Swapping systems does not handle the memory more flexibly as compared to the paging systems.
Paging:Only the required memory pages are moved to main memory from the swap device for execution. Process size does not matter. Gives the concept of the virtual memory. It provides greater flexibility in mapping the virtual address space into the physical memory of the machine. Allows more number of processes to fit in the main memory simultaneously. Allows the greater process size than the available physical memory. Demand paging systems handle the memory more flexibly.
Paging:Only the required memory pages are moved to main memory from the swap device for execution. Process size does not matter. Gives the concept of the virtual memory. It provides greater flexibility in mapping the virtual address space into the physical memory of the machine. Allows more number of processes to fit in the main memory simultaneously. Allows the greater process size than the available physical memory. Demand paging systems handle the memory more flexibly.
19. What are filters?
The term Filter is often used to refer to any program that can take input from standard input, perform some operation on that input, and write the results to standard output. A Filter is also any program that can be used between two other programs in a pipeline.
20. Differentiate multiuser from multitask.
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.
21. What is inode?
An inode is an entry created on a section of the disk set aside for a file system. The inode contains nearly all there is to know about a file, which includes the location on the disk where the file starts, the size of the file, when the file was last used, when the file was last changed, what the various read, write and execute permissions are, who owns the file, and other information