Cracking IT Interview



What is Unix?


Unix is an operating system like Windows or any other OS. This is multi-tasking  and multi-user operating system, means that more than one job at the same time can run simultaneously. The jobs may be foreground or background jobs at the same time. Also, more than one user shares same system resources at the same time. Other than this, there are some other features like:


  • Portability - It is portable to any system hardware with bare minimum number of adoption complexities. It can work with 8086 microprocessor to supercomputers.


  • Open System - Source code as well as executable code can be accessed by users and programmers. It's easy for developers to adapt Unix because codes are straight forward, modular and compact.


  • Program facility - It provides with Shell which gives the facility to give commands. It almost works like any programming language having its own set of keywords and syntax. By using these features we can write efficient programs or scripts.


  • Security - There are 3 levels of security features : (1) Using login ID and password, (2) File level security related to Read, Write and Execute permission and (3) File encryption.


  • Email facility - User can easily set up with mail facility, informational data can be scheduled and shared on a daily bases using "mailx" universal mailer.


  •  System call - Program interacts with Kernel with hundreds of System calls. It tells the Kernel to perform various task for program like - opening a file, counting a file, obtaining information from a file or executing a program.


  • Help facility - Unix provides its user with the manual pages for its command and keywords as well as other help facilities.







Unix History:


UNIX was initially developed in 1969 at Bell Laboratories in New Jersey. Bell Labs researchers Ken Thompson, Dennis Ritchie and team who had worked on Multics wanted to develop an operating system for their own Bell Labs’ programming, job control, and resource usage needs. When Multics was withdrawn, Ken Thompson and Dennis Ritchie needed to rewrite an operating system. The result was a system called UNICS (UNiplexed Information and Computing Service) which was an 'emasculated Multics'.


Unix Version 6 was released in 1975 which became very popular. It was free and distributed with its source code.In 1983, AT&T released Unix System V which was a commercial version. In 1990s, Linux got available which is running parallel to Unix. Now Unix is widespread and available from many sources, both free and commercial.



Different flavors of Unix:


  • AT&T's System V,


  • Berkeley's BSD,  


  • Sun's SunOS/Solaris,


  • IBM's AIX,


  • Hewlett-Packard HP-UX,


  • SGI's IRIX,


  • Apple's Mac OS X


  • Linus Torvald's Linux 


These all follow the UNIX standards POSIX (Portable Operating System Interface).


Different flavors of Linux:


  • Ubuntu
  • Fedora
  • RedHat
  • Linux Mint
  • openSUSE
  • PCLinuxOS
  • Debian
  • Mandriva
  • Sabayon/Gentoo



Unix Architecture:

















Kernel : It's the core part of operating system. This is the first program loaded after the system boot and having complete control over all the system resources. It handles system's memory management, device management, system calls also running processes and handling interrupts. It handles I/O requests from other software or application program and translate them into data processing signals for CPU. we can say whatever user is doing in the system, Kernel is ultimately responsible to manage all that and make user available with his services. 


Shell : This is just an another program which provides the interface between the kernel and the users or other application-softwares. This is also called Command Line Interpreter (CLI). It takes input from the standard input, executes the program and then provide the output to the standard output screen. It gives us the environment where we can run the commands or shell scripts.


Shell provides shell prompt "$" where it expects the command from user under blinking cursor position. Other default shell prompt is "#" for the superuser with all admin rights. We just need to give right commands and press "enter" to execute the commands at the prompt to get required output.


Different flavors of shells:


  • Bourne Shell (sh) : "$" is default shell prompt and script is having ".sh" file extension. 
  • Bourne-again shell (bash) : script is having ".bash" file extension. 
  • Korn shell (ksh) : script is having ".ksh" file extension. 
  • C - shell (csh) :  "%" is default shell prompt and script is having ".csh" file extension.
  • TENEX C shell (tcsh)
  • Z shell (zsh) 


Shell Script:


This is a collection of Unix commands with the sequential order of their execution. It also includes builtin keywords, comments starting from "#" sign and the shell bin path (as /bin/sh) at the top of the script. It follows its own programming syntax for the codes like "if" logical decision statements, ""for" looping constructs or "function" block of codes. 


Shell script is interpreted at the time of execution (one-by-one command at a time), is not used to be compiled (whole at once) in execution of codes. 







Unix File System:


Everything else in Unix is either a file or a process. Here the type of files like directory, link, block special file, socket file all are termed as "file" only.


Each and every file in Unix is assigned with a unique integer number which is called i-node. All the file attributes and file information are maintained in special area of the disk called i-node table. The purpose of using i-node is to uniquely identify the file in the working system environment.


File / Root structure:










  • etc : Contains user credentials and admin related files.
  • dev : Contains device related files.
  • bin : Contains binary executable files.
  • tmp : Contains temporary files created by system or user.
  • usr : Contains the information of different users.
  • var : Contains variable length files.
  • lib : Contains shared library files, sometimes kernel related files.
  • Others : other file are like /boot, /kernel, /unix, /proc, /mnt depending on the flavor of Unix we are using.



Unix / Linux System Boot Process:


  • BIOS searches for MBR (Master Boot Record) a boot loaer program. It is loaded into memory once detected and executed, BIOS gives the control to it. 
  • MBR is located in 1st sector of the bootable disk. It again executes another boot loader and finally Unix Kernel is loaded and executed.
  • Kernel executes the /sbin/init program. Init is the first process running in system with process ID -1. It is considered as the default parent process of all the processes in the environment.  
  • Init searches for the the inittab file (from /etc/inittab ) and it returns to the active port details ftp-21 and http-80.
  • It calls the getty program (/etc/getty) which is responsible for login prompt where we enter the user ID and password.
  • Once entering the user ID and password we get the user prompt on the shell terminal.


NEXT ->