Table of contents
1.
Introduction
2.
Basic Unix Interview Questions
2.1.
1. What exactly is UNIX?
2.2.
2. Describe the Unix architecture.
2.3.
3. Describe filters.
2.4.
4. What is Kernel described as?
2.5.
5. Describe Shell.
2.6.
6. Describe Shell's duties in a few words.
2.7.
7. What is the purpose of pipes in Unix?
2.8.
8. What are a few typical shells, and what are the signs of each one?
2.9.
9. What are the Korn Shell's salient characteristics?
2.10.
10. A single-user system is what, exactly?
2.11.
11. What are the distinctions between multiuser and multitasking?
2.12.
12. List a few of UNIX's key characteristics.
2.13.
13. What is the standard syntax for UNIX commands?
2.14.
14. What do you mean by Command substitution?
2.15.
15. How do shell variables work?
2.16.
16. Describe Bash Shell.
2.17.
17. What is a directory, exactly?
2.18.
18. What is an inode?
2.19.
19. What exactly makes an absolute path different from a related path?
2.20.
20. How do I list files and directories in alphabetical order using UNIX?
2.21.
21. What are the importance of directories in a UNIX system?
2.22.
22. What exactly is FIFO?
2.23.
23. What is the fork() system call?
2.24.
24. What is meant by ‘nohup’ in UNIX?
3.
Intermediate Unix Interview Questions
3.1.
25. What types of files are available under UNIX?
3.2.
26. List some of the most popular network commands in UNIX.
3.3.
27. Distinguish between the cmp and diff commands.
3.4.
28. In UNIX, how do you choose and set the path?
3.5.
29. Is it possible to view details about a process as it is running?
3.6.
30. What do the following commands—chmod, chown, and chgrp—do?
3.7.
31. Describe a UNIX link.
3.8.
32. How do you distinguish between grep and egrep in shell scripting?
3.9.
33. Distinguish between paging and swapping?
3.10.
34. What is a daemon, exactly?
3.11.
35. What is your knowledge of the MBR?
3.12.
36. Explain the Superblock in UNIX.
3.13.
37. How does UNIX kill a process?
3.14.
38. What benefit does running processes in the background have?
3.15.
39. Explain some file manipulation commands in UNIX.
3.16.
40. What causes a protection fault, and why?
3.17.
41. What does the term "region" mean?
3.18.
42. What is piping?
3.19.
43. What does "command substitution" mean to you?
3.20.
44. What function does the superuser perform?
3.21.
45. How would you differentiate system calls from library functions when it comes to Unix commands?
3.22.
46. What is meant by alias mechanism?
3.23.
47. Can you explain the functions of the "chmod," "chown," and "chgrp" commands?
3.24.
48. Could you provide an explanation on the process of modifying file access permissions?
4.
Advanced Unix Interview Questions
4.1.
49. Describe the networking protocol and stack for UNIX System.
4.2.
50. Explain the Virtual Memory Concept.
4.3.
51. What functionality does the '-l' provide when you list a directory?
4.4.
52. What does the UNIX zombie process do? What is the Zombie process like?
4.5.
53. How do you determine the hostname from an IP address in your network?
4.6.
54. Describe how UNIX systems boot up.
4.7.
55. What do the different UNIX process IDs stand for?
4.8.
56. Describe the many pathname kinds that can be employed in UNIX.
4.9.
57. What do you know about the interpretation of wildcards?
4.10.
58. What is your knowledge of the tee command's applications?
4.11.
59. Describe the mount and unmount commands.
4.12.
60. Can you explain the contrasting features and purposes of "ps -ef" and "ps -auxwww" in Unix command usage?
5.
Unix MCQ
5.1.
1. Which of the following is the core part of the Unix operating system?
5.2.
2. What command is used to list all files and directories in Unix?
5.3.
3. Which command is used to change the file permissions in Unix?
5.4.
4. How can you display the current directory in Unix?
5.5.
5. What does the grep command do in Unix?
5.6.
6. Which of the following commands is used to view the contents of a file in Unix?
5.7.
7. What is the purpose of the ps command in Unix?
5.8.
8. What does the mkdir command do?
5.9.
9. Which of the following commands is used to remove files in Unix?
5.10.
10. How can you terminate a process in Unix?
6.
Conclusion
Last Updated: Aug 31, 2024
Medium

Unix Interview Questions

Author Lekhika
2 upvotes
Career growth poll
Do you think IIT Guwahati certified course can help you in your career?

Introduction

UNIX is an operating system that was created in 1969 at AT&T Bell Labs in Murray Hills, New Jersey. Today, Unix is central to the technology industry, as many technologies depend on it. Many organizations prefer using Unix, and many people have encountered it at some point.

Unix Interview Questions

This article covers the most popular UNIX interview questions and solutions. The article's primary goal is to evaluate reader proficiency with the UNIX operating system, both theoretically and practically.

For your better understanding, we have divided this article into three sections Easy, Medium, and Hard. 

Basic Unix Interview Questions

One of the best ways to prepare for an interview is to revise all its topics from easy to hard. Easy-level questions are also crucial for your interview as the medium and challenging levels. Considering this section, we will discuss some of the easy-level questions of Unix Interview Questions.

1. What exactly is UNIX?

Ans: It is a portable operating system for effective multi-user and multi-tasking operations. Because of its mobility, it can function on various hardware systems.
It was created in C and enabled users to process and exercise control within a shell.

2. Describe the Unix architecture.

Ans: The kernel, shell, and user commands and applications are the three primary levels of the Unix operating system.
                                                     Unix Architecture
The operating system's kernel and shell are its heart and soul.
Kernel: The kernel processes user input through the shell and makes hardware access to tasks like allocating memory and storing files.

3. Describe filters.

Ans: Any program that can accept information from standard input, process that input, and send the results to standard output is commonly referred to as a filter. Any software utilised in a pipeline between two other programs is also referred to as a filter.

4. What is Kernel described as?

Ans: The principal application that manages the computer's resources is called the kernel. This part handles allocating resources to various users and tasks. When a user logs in to the system, the kernel launches a unique interactive software called a shell for each user, rather than communicating directly with them.

5. Describe Shell.

Ans: The user and the system are connected through a shell. The shell receives commands and prepares them for execution in its capacity as a command interpreter.

6. Describe Shell's duties in a few words.

Ans: The interviewer can also ask about the responsibilities of Shell. So let’s discuss this question in our Unix Interview Questions and Answers.

The primary responsibilities of the shells are:

  • The execution of the program.
  • File and variable name substitution.
  • Pipeline Connection.
  • Environment Management.
  • I/O Control and redirection,
  • Integrated Programming Language.

7. What is the purpose of pipes in Unix?

Ans: Pipes in Unix serve the purpose of connecting the output of one command to the input of another, allowing data to flow between processes. They enable the creation of powerful and efficient pipelines for data manipulation and processing.

8. What are a few typical shells, and what are the signs of each one?

Ans: The types of some standard shells are as follows:

  • sh: Bourne Shell
  • tcsh: Enhanced C Shell
  • csh: C Shell
  • ksh: Korn Shell
  • zsh: Z Shell
  • bash: Bourne Again Shell

9. What are the Korn Shell's salient characteristics?

Ans: Some of the main features of Korn Shell are:

  • The built-in editor that mimics emacs or vi
  • Built-in arithmetic of Integers
  • String manipulation abilities
  • Arrays
  • Aliasing of Commands
  • Command and Job Control

10. A single-user system is what, exactly?

Ans: Sometimes, the interviewer can also ask this type of easy question. So don’t ignore these questions and revise them in our Unix Interview Questions and Answers Section.

A personal computer with an operating system built for a single user to use at a time is referred to as a single-user system. Since inexpensive hardware is available and various applications to handle multiple functions, these systems are becoming more and more common.

11. What are the distinctions between multiuser and multitasking?

Ans: Multiuser refers to the ability of an operating system to support multiple users concurrently, each having its own user accounts and permissions. Unix-like systems are often multiuser. On the other hand, multitasking indicates an operating system's ability to execute multiple tasks or processes simultaneously, sharing CPU time among them. Multitasking enhances system efficiency and responsiveness.

12. List a few of UNIX's key characteristics.

Ans: Here are a few characteristics of UNIX:

  • Program execution.
  • Environment Control Management.
  • Language for integrated programming.
  • Input-output redirection.
  • independent of hardware
  • multi-user activities
  • Shells in Unix
  • a system of files in a hierarchy
  • Filters and pipes
  • Tools for Development Utilities
     

13. What is the standard syntax for UNIX commands?

Ans: Simple one-word commands like "date" can be found in UNIX command lines. They can also be more complicated, requiring you to write something other than the command name.

Arguments may or may not be required for a UNIX command. Optional or filename arguments are both acceptable. UNIX commands often take the following form:
Command [Parameters]  [Parameters]  [Parameters] [filename(s)]

14. What do you mean by Command substitution?

Ans: One of the processes that the shell goes through when processing instructions is command substitution. The shell carries out only commands placed in backquotes. This will subsequently replace the command line output and standard output.

15. How do shell variables work?

Ans: A shell variable consists of a name (an identifier) and a given value, both stored inside the shell. It's possible for these variables to have default values or for their values to be manually overridden by using the proper assignment command. PATH, TERM, and HOME are a few examples of shell variables.

16. Describe Bash Shell.

Ans: It is a free shell explicitly made for UNIX systems. As the standard shell for most UNIX-based computers, it integrates capabilities from both the C and Korn Shells.

17. What is a directory, exactly?

Ans: A directory is given to every file. A directory is a particular file that keeps track of all its files.

18. What is an inode?

Ans: A file system-specific disk area is designated for inodes, which are entries produced there. Nearly all of the information about a file is contained in the inode. This information comprises the starting point of the file on the disc, its size, the most recent use and modification dates, the read, write and execute rights, the file's owner, and other details.

19. What exactly makes an absolute path different from a related path?

Ans: The exact route as defined from the root directory is referred to as an absolute path. A related path is a path connected to the current place.

20. How do I list files and directories in alphabetical order using UNIX?

Ans: To list files and directories in alphabetical order, use the 'ls -l' command. The 'ls -lt' command lists down files and directories in order of when they were last modified.

21. What are the importance of directories in a UNIX system?

Directories in a UNIX system play a crucial role in organizing and structuring files and directories hierarchically. They provide a logical and efficient way to manage and access files, improving system usability and data management.

22. What exactly is FIFO?

Ans: FIFO (First In First Out) is a particular file for date transients; it is also known as named pipes. Data in written order is read-only. Data is written to one end and read from another end of the pipe in inter-process communications.

23. What is the fork() system call?

Ans: The fork() command starts a new process from an existing one. The new process id is referred to as the child process, while the primary process is referred to as the parent process. 

The parent process receives the kid's process id back while giving the child a value of 0. The process and the code run are verified using the returned values.

24. What is meant by ‘nohup’ in UNIX?

Ans: “nohup” is a command that allows you to run a command or a script in the background, even after you log out or close the terminal session. The name "nohup" stands for "no hang up," which means the process will not be terminated even if the terminal session ends or the user disconnects.

Intermediate Unix Interview Questions

We have discussed the easy-level Unix Interview Questions. Now it’s time to increase the difficulty level of our Unix Interview Questions gradually. So, let’s discuss some of the medium-level questions.

25. What types of files are available under UNIX?

Ans: Various file types under UNIX include:

  • Regular/Normal files
  • File directories
  • Special character files
  • FIFO
  • Block special files
  • Sockets
  • The Symbolic Links

26. List some of the most popular network commands in UNIX.

Ans: Some of the popular network commands in UNIX are:

  • PING: An echo request for connectivity checking.
  • TELNET: Used for the remote login system.
  • FTP: File Transfer Protocols used to transfer files between systems.
  • SU: Command used for User Switching.
  • FINGER: Command for acquiring information 
  • NSLOOKUP: It performs the DNS query.
  • HOSTNAME: This provides the IP Address and the domain name.

27. Distinguish between the cmp and diff commands.

Ans: The cmp command is primarily used to compare two files byte per byte, after which the first mismatch is displayed. 
On the other hand, the diff command is used to show the modifications that must be made to make the two files identical.

28. In UNIX, how do you choose and set the path?

Ans: A variable called PATH or path determines where the shell will look for a command each time you input one. When an error message is returned, it could be because the command was not on your path or because it didn't exist in the first place. The command "set path = [directory path]" can be used to set the path manually.

29. Is it possible to view details about a process as it is running?

Ans: A process identifier is used to identify each process specifically. The ps command can display information about a process, including its details and status.

30. What do the following commands—chmod, chown, and chgrp—do?

Ans: The following tasks can be performed:

  • We can change the file's permissions by using the chmod command.
  • We can change the file's ownership with the chown command.
  • We can change the file's group with the chgrp command.

31. Describe a UNIX link.

Ans: To give a file more than one name, utilise a link. It functions similarly to a pointer to a file; a file may have many pointers. Two different kinds of links exist.

Hard link: These hard-linked files reference the exact physical location of the file since they share the same inode value as the original. The link will continue to function even if the file is moved to a different directory.
The Syntax is:
ln [Original_Filename] [Link_Name]

Symbolic Link: A symbolic link has a different inode from the original one and is similar to the file shortcut feature. The link may not function if the original file is moved, but it can still refer to other files.
The Syntax is:
ln -s [Original_Filename] [Link_Name]

32. How do you distinguish between grep and egrep in shell scripting?

Ans: This is one of the most frequently asked questions in the Unix Interview Questions and Answers. Let’s understand the solution to this problem.
egrep is an advanced version of grep. egrep can search using extended regular expressions in addition to regular expressions.
The following command will determine if any files have the .env|.json extension.
$ ls | grep  '.env|.json.'

However, in this instance, since the character "|" will be regarded as a metacharacter, it checks to see whether any files have the ".env" or ".json" extensions.
$ ls | egrep  '.env|.json'

33. Distinguish between paging and swapping?

Ans: Swapping: In the case of swapping, the entire process is loaded into the main memory; as a result, only the processes that are less than the primary memory size can be executed. Although relatively simple to do, this is ineffective.

Paging, on the other hand, loads only the necessary memory pages into the main memory instead of loading the entire process. Although challenging to implement, this enables us to run several tasks simultaneously.

34. What is a daemon, exactly?

Ans: A daemon is a background task or process in charge of one or more specific duties. The Unix OS relies on this core idea. The multiple system daemons that make up the Unix kernel handle memory management, file system management, printer jobs, network connections, and several other functions.

35. What is your knowledge of the MBR?

Ans: Its full name is Master Boot Record, a little software that runs when a computer boots up to locate the operating system and load it into memory. The BIOS (basic input-output system) searches for the MBR during the initial stages of system boot-up, loads it into memory, and then the MBR takes control.

36. Explain the Superblock in UNIX.

Ans: A SuperBlock is a program that keeps records of particular file systems, including the block size, the number of empty and filled blocks and their corresponding counts, the size of block groups, and the location of the inode tables on the disc, and use data. 

Superblocks generally fall into one of two categories:

Default Superblock: The default superblock has a fixed offset from the first disc partition of the system.

Redundant Superblock: Redundant superblocks are replicas of the default superblock used in case the default superblock is damaged by a system crash or other faults.

37. How does UNIX kill a process?

Ans: The process ID (PID) is an argument that the kill command accepts. This only applies to processes that the command executor owns.
The Syntax for Killing the process is: kill PID.

38. What benefit does running processes in the background have?

Ans: The ability to run another process without waiting for the preceding one to finish is the public benefit of running processes in the background. The shell is instructed to run a command in the background by the symbol "&" at the end of the process.

39. Explain some file manipulation commands in UNIX.

Ans: The questions related to Commands are one of the most important topics of the Unix Interview Questions.

Some of the file manipulation commands are as follows:

  • cat filename: Show the contents of the file.
  • mv [old_name] [new_name]: Move or Rename the file. Here the old name and new name are provided.
  • Cp source destination: To copy the source file to the destination file.
  • rm filename: To delete/remove the files.
  • ls -f: The information about the type of the file.
  • ls -s [old_name] [new_name]: To create the symbolic to the old file.

40. What causes a protection fault, and why?

Ans: A protection fault occurs when a process accesses a page for which it does not have authorization. Additionally, a protection issue occurs when a process tries to write on a page whose copy on the write bit was set during the fork() system call.

41. What does the term "region" mean?

Ans: The text, data, and stack regions of a process's address space are identified as a region. The processes can share regions.

42. What is piping?

Ans: To merge two or more commands, use "piping." The first command's output serves as the second command's input, and so forth. The pipe symbol (|) is used to denote piping.

43. What does "command substitution" mean to you?

Ans: The questions related to Commands are one of the most important topics of the Unix Interview Questions.
The procedure used by the shell each time a command enclosed in a backquote is handled known as command substitution. This procedure displays it on the command line in place of the standard output.

The following actions can be carried out by command substitution:

  • Call the subshell
  • Bring about word splitting
  • Delete any last new lines.
  • The commands "redirection" and "cat" enable setting a variable to the file's content.
  • Permits setting a variable to the loop's output.

44. What function does the superuser perform?

Ans: In the Unix operating system, there are primarily three types of accounts:

  • Root account
     
  • System accounts
     
  • User Account

    The term "Root account" for user accounts is essentially the same as "Superuser." This user has total power over all files and commands on the system or fully open access. This user can also be considered the system administrator and is, therefore, free to execute any command. By using the root password, it is secured.

Must Read: SAP ABAP Interview Questions

45. How would you differentiate system calls from library functions when it comes to Unix commands?

Ans: In Unix, system calls and library functions are two different mechanisms used for interacting with the operating system and executing tasks. System calls are functions provided by the UNIX kernel while library functions are abstractions on top of system calls provided by user written programming libraries and scripts.

46. What is meant by alias mechanism?

Ans: In Unix an alias is a user-defined name that represents a command or a series of commands.

Example:

alias print_working_directory='pwd'

 

Now, if you type print_working_directory in the terminal, it will execute the pwd command. 

This is just an example, alias should be some short string which makes it easier to execute long commands.

47. Can you explain the functions of the "chmod," "chown," and "chgrp" commands?

Ans: The functions of the commands, "chmod," "chown," and "chgrp" are mentioned below:

  • chmod: Used to change file permissions, specifying who can read, write, or execute a file. It allows you to control access to files and directories
     
  • chown: Changes the owner of a file or directory, which is essential for managing file ownership and access control
     
  • chgrp: Alters the group ownership of a file or directory, useful for managing file access permissions within a group

48. Could you provide an explanation on the process of modifying file access permissions?

Ans: In Unix, you can modify file access permissions using the “chmod” command. This command allows you to change the read, write, and execute permissions for the owner, group, and others on a file or directory. chmod command can be used in two modes:-

Symbolic Mode

You can use simple symbols to assign permissions to owner, group and other users.

Syntax: 

chmod [who][operator][permissions] file(s)


For example, to add write permission for group and others on a file named file_1.txt, use the following command:

chmod g+w,o+w text_1.txt

 

Numeric Mode

You can permissions using numeric values. Each permission (read, write, execute) is assigned a value:

  • Read: 4
     
  • Write: 2
     
  • Execute: 1
     

The sum of these values represents the permission value.

Syntax:

chmod [permissions] file(s)

 

For example, to set read and write permission for the owner, and read-only permission for the group and others on a file named text_1.txt, use the following command:

chmod 644 text_1.txt

Advanced Unix Interview Questions

It’s time to practice some problematic UNIX Interview Questions. Below is the list of some hard-level UNIX Interview Questions.

49. Describe the networking protocol and stack for UNIX System.

Ans: TCP/IP is the standard networking stack protocol for the UNIX kernel. TCP/IP functions in two ways: 

  • IP (Internet Protocol) handles packet transmission between user programs and the networking layer, whereas 
  • TCP (Transmission Control Protocol) is in charge of the virtual circuit layer that enables bidirectional data transmission.

                                                                               Networking Protocol and Stack

50. Explain the Virtual Memory Concept.

Ans: A method or system for addressing more memory than is there is known as virtual memory. The model is made up of several memory pages, which are typically 4 KB apiece. There is a translation layer between virtual and physical memory addresses. 

To get the best performance possible while translating and mapping addresses, this translation layer, a kernel component, is typically written in machine language (Assembly). 
The kernel employs the address translation layer to translate the virtual memory address into a physical memory address each time a user accesses memory. More excellent addresses than are physically achievable are made possible via virtual addressing.

51. What functionality does the '-l' provide when you list a directory?

Ans: When listing a directory with the '-l' option (e.g., using the 'ls' command), it provides a detailed, long-format listing. This format includes additional information about each file, such as permissions, owner, group, file size, modification date, and filename. It is useful for obtaining comprehensive information about the files and directories in a listing.

52. What does the UNIX zombie process do? What is the Zombie process like?

Ans: Child processes that are complete before the parent process are zombie processes. The process structure and address space are thus deleted after completion and released to the system, but the item in the process table is left in place. The parent dials wait() to inquire about the status of the child's process. The kid is referred to as a "zombie" during the time between the child terminating and the parent invoking wait().

53. How do you determine the hostname from an IP address in your network?

Ans: The nslookup command is used to query internet domain name servers, and it may also be used to perform a reverse lookup and find the hostname from an IP address.

54. Describe how UNIX systems boot up.

Ans: When the system starts, it is the first thing. The main phases are five:

  • Hardware: BIOS checks for the hardware connection during system boot up.
     
  • Operating System Loader: The MBR, or Master Boot Record, is the first 512 bytes of the boot device and contains the OS loader.
     
  • Kernel: It initialises numerous computer parts, the operating system, and every piece of software that performs a task; typically regarded as a driver root user.
     
  • Space process (init and inittab): The space process (init and inittab) provides the administrator a simple way to create an environment for some usage by defining what should be executed when the /sbin/init program is prompted to enter a specific run-level.
     
  • Boot scripts: There is a single startup script present in a particular directory for each managed service (such as mail, nfs server, cron, etc.).

55. What do the different UNIX process IDs stand for?

Ans: The Unix process is identified by three ids:

  • PID stands for Process Id, a specific number between 0 and 3000.
  • Parent process ID (PPID)
  • Processes are grouped using the PGID or process group id.

    The functions getppid(), getpid(), and getpgrp() return the Parent Process ID, the Process ID, and the Process Group ID, respectively. A real user ID (the UID), an effective user ID (the EUID), a real user group ID (the GID), and an effective user group ID are also present in the process (the EGID).

56. Describe the many pathname kinds that can be employed in UNIX.

Ans: Any operating system's file system has a hierarchy of directories, and "Path" is defined as the specific location of a file or directory so that it may be accessed.
In Unix, there are essentially just two types of paths. The following is a definition of these:

  • Absolute pathnames: These define a complete path indicating the location of a file or directory starting from the root directory (/) of the existing file system.
    Absolute pathnames address system configuration files that do not move. It defines a complete route indicating the starting point of the actual file system, i.e., the root directory (/), from which a file or directory can be found. Absolute pathnames address system configuration files that do not move.
     
  • Relative Pathname specifies the route from the user's current working directory or current working directory (pwd). The term "relative pathname" denotes the current directory, the parent directory, and files that are difficult or difficult to access. It specifies the route from the user's current working directory, also known as the present working directory (pwd).
    The term "relative pathname" denotes the current directory, the parent directory, and files that are difficult or cumbersome to access.

57. What do you know about the interpretation of wildcards?

Ans: Wildcard characters are a unique class of characters that can stand in for one or more other characters. Wildcard interpretation is used when these characters are present in a command line. In this instance, a sorted list of files is used in place of these characters when the pattern fits the input instruction.

Wildcard characters like the asterisk (*) and question mark (?) are frequently utilised to create a list of files to process.

58. What is your knowledge of the tee command's applications?

Ans: In general, pipelines and filters are used in conjunction with the "tee" command. Essentially, this command accomplishes two things:

  • Obtain information from standard input and send it to standard output.
  • A copy of the input data is forwarded to the selected file.

59. Describe the mount and unmount commands.

Ans: The mount and unmount commands are as follows: 

  • As its name implies, the mount command allows users to access a storage device or file system by mounting it on an existing directory.
  • The unmount command safely detaches the mounted file system to unmount it. This command's other function is to tell the system to finish any pending read and write activities.

60. Can you explain the contrasting features and purposes of "ps -ef" and "ps -auxwww" in Unix command usage?

Ans: The “ps -ef” and “ps -auxwww” commands are both used for displaying information about the running processes in a UNIX operating system, but there are differences in their output format and behavior.

ps -ef command

The “ps -ef” command displays process information in a simplified format, where each process has some limited number of columns. These columns include, process ID, user ID, parent process ID, etc. This command may not display information related to daemons, kernel thread or background processes.

ps -auxwww command

The “ps -auxwww” command provides the process information in a more detailed format with more columns such as process arguments, memory usage, start time of the process, etc. It displays information about all the processes in the system along with kernel threads, background processes and running daemons, however this command is only supported by older UNIX operating systems such as Solaris.

Unix MCQ

1. Which of the following is the core part of the Unix operating system?

  • a) Shell
  • b) Kernel
  • c) Application Programs
  • d) Command Interface
    Answer: b) Kernel

2. What command is used to list all files and directories in Unix?

  • a) list
  • b) ls
  • c) dir
  • d) show
    Answer: b) ls

3. Which command is used to change the file permissions in Unix?

  • a) chmod
  • b) chperm
  • c) changeperm
  • d) permset
    Answer: a) chmod

4. How can you display the current directory in Unix?

  • a) pwd
  • b) cd
  • c) displaydir
  • d) showdir
    Answer: a) pwd

5. What does the grep command do in Unix?

  • a) Searches for a string in files
  • b) Deletes files
  • c) Renames files
  • d) Copies files
    Answer: a) Searches for a string in files

6. Which of the following commands is used to view the contents of a file in Unix?

  • a) cat
  • b) view
  • c) display
  • d) open
    Answer: a) cat

7. What is the purpose of the ps command in Unix?

  • a) To display currently running processes
  • b) To print files
  • c) To change directory
  • d) To set permissions
    Answer: a) To display currently running processes

8. What does the mkdir command do?

  • a) Creates a new directory
  • b) Deletes a directory
  • c) Moves a directory
  • d) Copies a directory
    Answer: a) Creates a new directory

9. Which of the following commands is used to remove files in Unix?

  • a) rm
  • b) del
  • c) remove
  • d) erase
    Answer: a) rm

10. How can you terminate a process in Unix?

  • a) kill
  • b) stop
  • c) end
  • d) terminate
    Answer: a) kill

Conclusion

This brings us to the end of the article. We’ve covered a wide range of UNIX interview questions and answers in detail. We hope you found it helpful and feel prepared to excel in your upcoming UNIX interview.

Recommended Reading:

You can also practice top Coding UNIX interview Questions such as:

Do upvote our blogs. Head over to our practice platformCode360 to practice top problems, attempt mock tests, read interview experiences, interview bundle, follow guided paths for placement preparations, and much more!!

 We wish you Good Luck! Keep coding and keep reading Ninja!!

Live masterclass