UNIX Interview Questions and Answers

by Nithyanandham, on Sep 10, 2022 5:31:29 PM

Interview Questions (56)

Q1. What do you mean by UNIX?

Ans: UNIX is efficient multitasking, multiuser functioning computer operating systems An portable operating system analogous to DOS and Windows, supporting multiple concurrent users. Its portability allows it to run on different hardware platforms.

Q2. Which languages are used to write UNIX?

Ans: Unix is Written in C and assembly language

Q3. Who are the developers involved in Creating UNIX?

Ans: Developer involved for Development of UNIX are:
Ken Thompson
Dennis Ritchie
Brian Kernighan
Douglas McIlroy
And Joe Ossanna at Bell Labs

Q4. What do you mean by shell in UNIX?

Ans: Shell in UNIX is: Command-line interpreter, which is used to execute Commands entered by user
Users typically interact with a Unix shell using a terminal emulator
In Unix User Directs the Computer by entering commands by text or by creating one or more text scripts of Commands and allow command line interpreter to execute.

Q5. Which are commonly used Shells in Unix?

Ans: 5 Most Frequently Used Open Source Shells for Linux

  1. Bash Shell
  2. Tcsh/Csh Shell
  3. Ksh Shell
  4. Zsh Shell
  5. Fish

Q6. Is Unix different from Linux?

Ans: Linux is a UNIX Clone written from scratch by Linus Torvalds with assistance from a loosely-knit team of hackers across the Net.It aims towards POSIX The Portable Operating System Interface (POSIX) compliance.

Q7. What is Solaris?

Ans: Solaris is Sun micro systems UNIX.

Q8. Which command you use to change the password?

Ans: Command you use to change the password is“passwd”

Q9. What is the use of Login program?

Ans: Login Program is responsible to bring the login prompt.

10.What is LILO?

Ans:   LILO stands for LInux LOader. LILO is a Linux Boot Loader that loads Linux Operating System into the main memory to begin execution. Most of the computers come with boot loaders for certain versions of Windows or Mac OS. So, when you want to use Linux OS, you need to install a special boot loader for it. LILO is one such boot loader. 

When the computer is started, BIOS conducts some initial tests and transfers control to the Master Boot Record. From here, LILO loads the Linux OS and starts it.

The advantage of using LILO is that it allows fast boot of Linux OS. 

11.List a few significant features of UNIX?

Ans: The following are a few features of UNIX;

  • Machine independent
  • Portability
  • Multi-user operations
  • Unix Shells
  • Hierarchical file system
  • Pipes and filters
  • Background processors
  • Utilities
  • Development tools

12.What is the general format of UNIX command syntax?

Ans: Generally, UNIX shell commands follow the following pattern

Command (-argument) (-argument) (-argument) (filename)

13.Describe the usage and functionality of the command rm –r * in UNIX?

Ans: The command rm –r * erases all files in a directory with its subdirectories.

  • rm is for deleting files
  • -r is to delete directories and subdirectories with files within
  • is indicate all entries

14.Which UNIX command lists files/folders in alphabetical order?

Ans: The ls –l command is used to list down files and folders in alphabetical order, sorted with modified time.

15.Name the different file types available with UNIX.

Ans: Following the different file types in UNIX;

  • Regular files
  • Directory files
  • Character special files
  • Block special files
  • FIFO
  • Symbolic links
  • Socket

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

Ans: Following are the purposes of the given UNIX commands;

  • chmod changes the permission set of the file.
  • chown changes the ownership of the file.
  • chgrp changes the group of the file.

17.What are the various IDs in UNIX processes?

Ans: A process ID is a unique integer that UNIX uses to identify a certain process.

The process executes to initiate other processes is called parent process and its ID is defined as PPID (Parent Process ID).

  • getppid() retrieves the Parent Process ID

Every process is associated with a specific user and is called the owner of the process. The owner has all the privileges over the process. The owner is also the user who executes the process.

Identification for a user is User ID. The process also associated with Effective User ID which determines the access privileges to accessing resources like files.

  • getpid() retrieves the Process ID
  • getuid() retrieves the User ID
  • geteuid() retrieves the Effective User ID

18.How can you kill a process in UNIX?

Ans: The Kill command accepts process ID (PID) as an in a parameter. This is applicable only for the processes owned by the command executor.

Syntax –kill PID

19.Which UNIX command to make a new directory?

Ans: The commandmkdir directory_nameis used to create a new directory.

20.What is the UNIX command to confirm a remote host is alive or not?

Ans: You can use either pingortelnetto confirm a remote host is alive or not.

21.What is the ‘nohup’ in UNIX?

Ans: To run a process in the background, nohup is a special command. The process started with this command does not terminate even if the user logs off from the system.

22.What do you understand by UNIX shell?

Ans: The UNIX shell serves as an environment to run commands, programs, and shell scripts. In addition to that, it also acts as an interface between the user and the Unix OS. Shell issues $ as the command prompt, which reads input and determines the command to execute.

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

Ans: 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 maybe 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.

24.What is the standard convention being followed when naming files in UNIX?

Ans: 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.

25.Explain Superblock in UNIX?

Ans: Each logical partitions in Unix are referred to as the File system and each file system contains, a ‘boot block’, a ‘superblock’, ‘inodes’, and ‘data blocks’. The superblock is created at the time of the creation of the file system.

It describes the following:

  • State of the file system
  • The total size of the partition
  • Block size
  • Magic number
  • The inode number of the root directory
  • Count of the number of files, etc

There are basically two types of superblocks:

  • Default superblock: It has its existence always as a fix offset from the beginning of the system’s disk partition.
  • Redundant superblock: It is referenced when the default superblock is affected by a system crash or some errors.

26. Enlist some filename manipulation commands in UNIX?

Ans: Some filename manipulation commands along with their description is enlisted below in the table:

Command Description
cat filename Displays contents of the file
cp source destination Used to copy source file into the destination
mv old name new name Move/rename and old name to the new name
rm filename Remove/delete filename
Touch filename Changing modification time
In [-s] old name new name Creates soft link on old name
Is –F Displays information about file type

 

 

 

 

 

 

 

 

 

 

 

27.Explain the alias mechanism?

Ans: To avoid typing long commands or to improve efficiency, the alias command is used to assign another name to a command. Basically, it acts as a shortcut to the larger commands which can be typed and run instead.

For creating an alias in Unix, following command format is used:

alias name=’command you want to run’

Here, replace the ‘name’ with your shortcut command and replace ‘command you want to run’ with the larger command of which you want to create an alias of.

For Example, alias dir ‘Is –sFC’

Here, in the above example, ‘dir’ is another name for the command ‘Is-sFC’. Thus user now simply is required to remember and use the specified alias name and the command will perform the same task as to be performed by the long command.

Topics:Interview Questions with Answers

Comments

Subscribe