300+ TOP Unix/xenix Interview Questions and Answers

Q1. Describe File Systems In Unix?

Understanding file systems in UNIX has to do with knowing how files and inodes are stored on a system. What happens is that a disk or portion of a disk is set aside to store files and the inode entries. The entire functional unit is referred to as a file system.

Q2. What Are Shell Variables?

Shell variables are a combination of a name ( identifier), and an assigned value, which exist within the shell. These variables may have default values, or whose values can be manually set using the appropriate assignment command. Examples of shell variable are PATH, TERM and HOME.

Q3. What Are Some Common Shells And What Are Their Indicators?

sh – Bourne shell
csh – C SHell
bash – Bourne Again Shell
tcsh – enhanced C Shell
zsh – Z SHell
ksh – Korn SHell

Q4. What Is A Superuser?

A superuser is a special type user who has open access to all files and commands on a system. Note that the superuser’s login is usually root, and is protected by a so-called root password.

Q5. What Is Parsing?

Parsing is the process of breaking up of a command line into words. This is made possible by using delimiters and spaces. In the event that tabs or multiple spaces are part of the command, these are eventually replaced by a single space.

Q6. What Is The Use Of -l When Listing A Directory?

-l, which is normally used in listing command like ls, is used to show files in a long format, one file per line. Long format refers to additional information that is associated with the file, such as ownership, permissions, data and filesize.

Q7. What Is A Typical Syntax Being Followed When Issuing Commands In Shell?

Typical command syntax under the UNIX shell follows the format:

Command [-argument] [-argument] [–argument] [file]

Q8. What Is The Standard Convention Being Followed When Naming Files In Unix?

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.

Q9. Is There A Way To Erase All Files In The Current Directory, Including All Its Sub-directories, Using Only One Command?

Yes, that is possible. Use “rm –r *” for this purpose. The rm command is for deleting files. The –r option will erase directories and subdirectories, including files within. The asterisk represents all entries.

Q10. Explain The Importance Of Directories In A Unix System?

Files in a directory can actually be a directory itself; it would be called a subdirectory of the original. This capability makes it possible to develop a tree-like structure of directories and files, which is crucial in maintaining an organizational scheme.

Q11. What Is Inode?

An inode is an entry created on a section of the disk set aside for a file system. The inode contains nearly all there is to know about a file, which includes the location on the disk where the file starts, the size of the file, when the file was last used, when the file was last changed, what the various read, write and execute permissions are, who owns the file, and other information.

Q12. What Is Bash Shell?

It is a free shell designed to work on the UNIX system. Being the default shell for most UNIX-based systems, it combines features that are available both in the C and Korn Shell.

Q13. What Is Kernel?

Kernel is the UNIX operating system. It is the master program that controls the computer’s resources, allotting them to different users and to different tasks. However, the kernel doesn’t deal directly with a user. Instead, it starts up a separate, interactive program, called a shell, for each user when he/she logs on.

Q14. What Are Filters?

The term Filter is often used to refer to any program that can take input from standard input, perform some operation on that input, and write the results to standard output. A Filter is also any program that can be used between two other programs in a pipeline.

Q15. What Is Unix?

It is a portable operating system that is designed for both efficient multi-tasking and mult-user functions. Its portability allows it to run on different hardware platforms. It was written is C and lets user do processing and control under a shell.

Q16. Write A Command That Will Display Files In The Current Directory, In A Colored, Long Format.

ls -l –color

Q17. What Would Be The Effect Of Changing The Value Of Path To: .:/usr/della/bin: /bin: /usr/bin

This would cause the shell to look in the /usr/della/bin directory after looking in the current directory and before looking in the /bin directory when searching for a command file.

Q18. What Is Piping?

Piping, represented by the pipe character “|”, is used to combine two or more commands together. The output of the first command serves as input the next command, and so on.

Q19. Is It Possible To See Information About A Process While It Is Being Executed?

Every process is uniquely identified by a process identifier. It is possible to view details and status regarding a process by using the ps command.

Q20. How Do You Determine And Set The Path In Unix?

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.

Q21. Differentiate Cmp Command From Diff Command?

The cmp command is used mainly to compare two files byte by byte, after which the first encountered mismatch is shown. On the other hand, the diff command is used to indicate the changes that is to be made in order to make the two files identical to each other.

Q22. What Are The Differences Among A System Call, A Library Function, And A Unix Command?

A system call is part of the programming for the kernel. A library function is a program that is not part of the kernel but which is available to users of the system. UNIX commands, however, are stand-alone programs; they may incorporate both system calls and library functions in their programming.

Q23. What Is A Directory?

Every file is assigned to a directory. A directory is a specialized form of file that maintains a list of all files in it.

Q24. What Is Shell?

A shell acts as an interface between the user and the system. As a command interpreter, the shell takes commands and sets them up for execution.

Q25. What Is Wild-card Interpretation?

When a command line contains wild-card characters such as ‘*’ or ‘?’, these are replaced by the shell with a sorted list of files whose pattern matches the input command. Wild-card characters are used to setup a list of files for processing, instead of having it specified one at a time.

Q26. What Is The Use Of The Tee Command?

The tee command does two things: one is to get data from the standard input and send it to standard output; the second is that it redirects a copy of that input data into a file that was specified.

Q27. Enumerate Some Of The Most Commonly Used Network Commands In Unix?

  • telnet – used for remote login
  • ping – an echo request for testing connectivity
  • su – user switching command
  • ftp – file transfer protocol used for copying files
  • finger – information gathering command

Q28. What Are The Key Features Of The Korn Shell?

  • history mechanism with built-in editor that simulates emacs or vi
  • built-in integer arithmetic
  • string manipulation capabilities
  • command aliasing
  • arrays
  • job control

Q29. Differentiate Cat Command From More Command?

When using the cat command to display file contents, large data that does not fit on the screen would scroll off without pausing, therefore making it difficult to view. On the other hand, using the more command is more appropriate in such cases because it will display file contents one screen page at a time.

Q30. What Is Pid?

Pid is short for Process ID. It is used primarily to identify every process that runs on the UNIX system, whether it runs on the foreground or runs at the background. Every pid is considered unique.

Q31. How Do You Switch From Any User Type To A Super User Type?

In order to switch from any user type to a superuser, you use the su command. However, you will be asked to key in the correct superuser password before full access privileges are granted to you.

Q32. Why Is It That It Is Not Advisable To Use Root As The Default Login?

The root account is very important, and with abusive usage, can easily lead to system damage. That’s because safeguards that normally apply to user accounts are not applicable to the root account.

Q33. You Have A File Called Tonky In The Directory Honky. Later You Add New Material To Tonky. What Changes Take Place In The Directory, Inode, And File?

The directory entry is unchanged, since the name and inode number remain unchanged. In the inode file, the file size, time of last access, and time of last modification are updated. In the file itself, the new material is added.

Q34. What Is Command Substitution?

Command substitution is one of the steps being performed every time commands are processed by the shell. Commands that are enclosed in backquotes are executed by the shell. This will then replace the standard output of the command and displayed on the command line.

Q35. How Does The System Know Where One Command Ends And Another Begins?

Normally, the newline character, which is generated by the ENTER or RETURN key, acts as the signpost. However, the semicolon and the ampersand characters can also serve as command terminators.

Q36. Differentiate Relative Path From Absolute Path?

Reative path refers to the path relative to the current path. Absolute path, on the other hand, refers to the exact path as referenced from the root directory.

Q37. Differentiate Multiuser From Multitask?

Multiuser means that more than one person can use the computer at the same time. Multitask means that even a single user can have the computer work on more than one task or program at the same time.