Unix Interview Questions

Facebook
Twitter
LinkedIn

Never miss a post!

Sign up for our newsletter and get FREE Development Trends delivered directly to your inbox.

You can unsubscribe any time. Terms & Conditions.
Categories

Unix is a multi-user, multitasking, and multiprocessing operating system. It is also a command-line interpreter, which was developed at AT&T Bell laboratories Research Center in the USA in 1969 by Ken Thompson and Dennis Ritchie. Earlier Unix was written in assembly language and originally spelled as UNICS (uniplexed information computing system/service). Later, it was rewritten in C programming language and termed as Unix. Some Unix operating systems are open source, and some are not.

Are you preparing for Unix interviews and looking for frequently asked Unix interview questions? Well, you have landed at the right place. It can be overwhelming to find a lot of Unix interview questions online but going through all of them can be very time taking. In this blog, I will talk about the top 20 Unix interview questions that you must know in order to crack your Unix interviews with ease. So, let’s get started!

Unix Interview Questions

Q1. What are the important features of Unix?

  • Multi-user: More than one user can use the machine simultaneously supported via terminals.
  • Multitasking: Multiple programs can run at the same time in parallel.
  • Multi-process: Each user can execute several processes simultaneously.
  • Hierarchical structure: Unix directories are present as a tree structure to support the organization and maintenance of files.
  • Open system: Some of the Unix operating systems are open source. Users can modify the Unix operating system source code.
  • Portability: It is the ability of the software that operates from one machine to another machine having different configurations. Unix allows users to transfer data from one system to another.
  • Programming facility: Unix shell can be used as a programming/scripting language.
  • Communication facility: Unix allows communication between different users by providing some information.
  • Security: Unix has system-level security controlled by the System Administrator and file-level security controlled by the owner of the file.
  • Tools and utilities: Supports many tools, libraries, and utilities to aid software development.
  • Piping: In piping concept, the output of the first command/process becomes the input of the next command/process.
  • Modularity: Unix consists of multiple number of independent modules or programs which perform different elementary tasks.
  • Help facility: In Unix, ‘man’ command is used to view help content on any command.

 

Q2. What are the important functions of the Unix operating system?

  • Memory management
  • Device management
  • Process management
  • File management
  • Job scheduling
  • Security
  • System performance
  • Error detection
  • Coordination between users and other software

 

Q3. Tell the similarities between Unix, MS-DOS, and MS Windows.

Similarities between Unix and MS-DOS:

  • Both Unix and MS-DOS have a command-line interface
  • Both have the concept of piping and I/O redirection
  • Hierarchical directory structure with the root directory at the top
  • Option to give read, write, and execute permissions on files
  • Wildcard character concept to override any system at any point in time

 

Similarities between Unix and MS-Windows:

  • Both are multitasking operating system
  • Both support built-in networking with TCP/IP as the standard protocol

 

Q4. Tell the differences between Unix and Windows.

Unix Windows
Unix file system is a hierarchical model Windows file system is a flat model
Unix is a command user interface operating system Windows is a graphical user interface operating system
Unix is a multi-user and multitasking OS Windows is a single user and multitasking OS
Unix is a free, open source operating system Windows is a licensed operating system
Unix is case sensitive Windows is not case sensitive
Unix has dumpy terminals (without hard disk) Windows do not support dumpy terminals
Unix is not user friendly Windows is user friendly
Unix supports programming facility Windows do not support programming facility
Unix has multiple vendors Windows have only one vendor, and that is Microsoft

 

Q5. Tell the differences between Unix and Linux.

  Unix Linux
Use It can be used in Internet servers, workstations and personal computers It can be used by everyone from home users to develop us and computer enthusiasts
Development & Distribution It is developed by AT&T and various commercial vendors and non-profit organizations It is developed by open source development and it is distributed by various vendors
Architecture Available on PA-RISC and Itanium machines Originally developed for intel’s x86 hardware. Ports available for several CPU types.
Processor X86/x64,Sparc, Power Itanium, PA-RISC, PowerPC and many others Several kinds of processors are used
File System Support jfs, gpfs, hfs, hfs+, ufs, xfs, zfs formats Ext2, Ext3, Ext4, jfs, ReiserFS, Xfs, Btrfs, FAT, NTFS and more
Shell interface BASH (Bourne Again Shell) is the Linux default shell. It can support multiple command interpreters. Originally the Bourne Shell. Now, it is compatible with many others including BASH, Korn & C.
Graphical User Interface Initially, Unix was a command based OS, but later GUI was created called Common Desktop Environment. Most distributions now ship with GNome. Linux typically provides two GUIs, KDE and Gnome, but there many other alternatives also such as LXDE, Xfce Unity, Mat, twm and more
Threat Detection It is slow and takes time for proper bug fixing It is very fast, as Linux is community driven and several developers from different parts of the world start working together to solve threats in Linux
Source Code Not available to anyone Available to everyone
License Different flavours of Unix have different cost structures according to vendors Linux is freely distributed and downloaded, but there are paid versions also

 

Q6. What are the limitations of Unix?

  • Firstly, it has an unfriendly and inconsistent user interface.
  • Apart from that, the UNIX OS is designed for a slow computer system, so you can’t really expect a fast performance versions.
  • On various machines are slightly different in UNIX, so it lacks consistency.
  • UNIX does not provide any assured hardware interrupt response time, so it does not really support real-time response time systems.
  • Also, the shell interface can be treacherous because a single typing mistake can destroy a lot of files.

 

Q7. What is a Shell?

It is a command-line interpreter. It translates the commands entered by the user and then converts them into a language that is understood by the kernel. The typical operations that it performs include file manipulation, program execution, and printing texts. The shell is the utility that processes your requests when you type in a command at your terminal, the shell interprets that command and calls the program you want. It uses standard syntax for all the commands.

 

Q8. What are Filters in Unix?

Filters in Unix are programs that take plain text as standard input, transform the input into a meaningful format, and return a standard output. Few commonly used filters are cat, sort, grep, head, tail.

 

Q9. How to change the password in UNIX operating system?

You can use the passwd command to change the password of any user on Unix OS.

Syntax: passwd username

 

This will ask you to enter a new password twice and finally a success message for password change.

Enter new UNIX password: 

Retype new UNIX password: 

passwd: password updated successfully

 

Q10. How do you see the disk usage on a UNIX OS?

You can use df and du commands:

df command tells the disk space which is being used and also available for use

du command shows the statistics of disk usage on every directory on the Unix server.

 

Q11. What is the difference between hardlink and softlink in UNIX?

You can create a shortcut in Unix with the help of links. There two kinds of links: softlink and hardlink. There is something called an inode for every file of the file system, which has information along with all the file attributes except for its name.

A softlink is an actual link to the original file. These links will have different inodes with different values. The softlink points to the original file so, if the original file is deleted, then the softlink fails. If you delete the softlink, nothing will happen to the file. This is because the actual file or directory inode is different from the softlink created with the file’s inode.

A hardlink acts like a mirror copy of the original file. These links share the same inodes, and changes made to the original or the hardlink file will reflect on another also. That is why when you delete a hardlink, nothing will happen to the other file. Hardlinks cannot cross file systems, whereas softlinks can.

Hence deleting the original file does not affect the hardlink, whereas deleting the original file makes the softlink inactive.

 

Q12. What are some common shells used?

There are two main kinds of Shells: Bourne shell and C shell. Some common derivatives of bourne shell that we use are the bourne shell or the regular shell, Korn shell, bourne-again shell or bash, and the POSIX shell. Some common C shell types are the C shell, the TENEX C shell, and the Z shell.

 

Q13. How do you determine and set the path in UNIX?

To set the path, you can edit the .profile file in Unix systems and add the path, for example: $PATH=/usr/bin/demo

 

To determine the path, you can use echo $PATH

 

Q14. What is a PID?

PID, a short form of process identifier, is a unique number to identify the processes running on the Unix OS. You can use ps or top commands to list the PIDs.

 

Q15. What is meant by the term Super User?

In Unix, the super user is called as root. This user has unrestricted access to all the directories, files, commands, and resources. The root user can also grant or remove permissions to other users.

 

Q16. What do chmod, chown, chgrp commands do?

chmod: It is used to change the access (read, write, execute) permissions of a file for owner, group, and others.

chown: It is used to change the ownership of a file. Only the owner of the file is allowed to change the ownership.

chgrp: It is used to change the group ownership of a file.

 

Q17. How can you kill a process in UNIX?

You can use the kill command with -9 (it means sure kill) and process ID or the pkill command with the process name.

Syntax: kill -9 pid

or

Syntax: pkill process_name

 

Q18. What does the “echo” command do?

echo is a built-in command which is used to print the text that are passed as an argument. It is majorly used in shell scripting and batch file to show the status.

Syntax: echo “Welcome to Unix Interview Questions”

Output: Welcome to Unix Interview Questions

Q19. Differentiate Swapping and Paging.

Swapping is a mechanism where a process is swapped temporarily from main memory to secondary storage to make some memory available to other processes.

Paging is a memory management technique in which computer stores and retrieves data from secondary storage to use in main memory.

 

Q20. What does a Pipe do?

Pipe is used to run two or more commands together. The output of command one is the input to command two. The symbol used is “|”.

For example: cat demo | grep -v a | sort -r

Here the output of cat demo is the input to grep -v a and output of grep -v a is the input to sort -r.

Final Thoughts

Unix is a vast topic, and there is plenty to learn. Do not just mug up these answers, understand the technicalities of these answers also. There are thousands of Unix interview questions you can find online, but these are the top 20 Unix interview questions that will give you a kickstart to your future Unix interviews. So, prepare well and all the best!

 

Facebook
Twitter
LinkedIn

Our website uses cookies that help it to function, allow us to analyze how you interact with it, and help us to improve its performance. By using our website you agree by our Terms and Conditions and Privacy Policy.