Unix Interview Questions and Answers
Question - 51 : - What is the process group?
Answer - 51 : - A collection of one or more processes is called a process group. There is a unique process id for each process group. The function “getpgrp” returns the process group ID for the calling process.
Question - 52 : - What are the different file types available with UNIX?
Answer - 52 : -
Different file types are:
- Regular files
- Directory files
- Character special files
- Block special files
- FIFO
- Symbolic links
- Socket
Question - 53 : - What is the behavioral difference between “cmp” and “diff” commands?
Answer - 53 : -
Both commands are used for file comparison.
- Cmp – Compare given two files with byte by byte and display the first mismatch.
- Diff – Display changes that need to do to make both files identical.
Question - 54 : - What are the duties of the following commands: chmod, chown, chgrp?
Answer - 54 : -
- chmod – Change the permission set of the file.
- chown – Change ownership of the file.
- chgrp – Change group of the file.
Question - 55 : - What is the command to find today’s date?
Answer - 55 : -
The “date” command is used to retrieve the current date.
Question - 56 : - Explain the method of changing file access permission?
Answer - 56 : -
There are three sections to be considered while creating/changing file access permission.
- File owner’s user ID
- File owner’s group ID
- File access mode to define
These three parts are arranged as follows:
(User permission) – (Group permission) – (other permission)
Three types of permission are
r – Reading permission
w – Writing permission
x – Execution permission
Question - 57 : - What are the various IDs in UNIX processes?
Answer - 57 : -
Process ID is a unique integer that UNIX uses to identify each process. The process executes to initiate other processes is called parent process and its ID is defined as PPID (Parent Process ID).
getppid() – Is a command to retrieve PPID
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 the User ID. The process is also associated with Effective User ID which determines the access privileges for accessing resources like files.
- getpid() – Retrieve process id
- getuid() – Retrieve user-id
- geteuid() – Retrieve effective user-id
Question - 58 : - How to Kill a process in UNIX?
Answer - 58 : -
The kill command accepts process ID (PID) as a parameter. This is applicable only for the processes owned by the command executor.
Syntax – kill PID
Question - 59 : - Explain the advantage of executing processes in the background?
Answer - 59 : - The general advantage of executing processes in the background is to get the possibility to execute some other process without waiting for the previous process to get completed. The symbol “&” at the end of the process tells the shell to execute a given command in the background.
Question - 60 : - Discuss the difference between swapping and paging?
Answer - 60 : -
Swapping: The complete process is moved to the main memory for execution. To provide the memory requirement, the process size must be less than the available main memory capacity. The implementation is easy but is an overhead to the system. Memory handling is not more flexible with swapping systems.
Paging: Only the required memory pages are moved to the main memory for execution. The size of the process does not matter for execution and it does not need to be less than available memory size. Allow a number of processes to load to the main memory simultaneously.