• LOGIN
  • No products in the cart.

Updated KornShell Interview Questions-2021

1.What is Shell?

A shell is a special user program that provides an interface to a user to use operating system services. Shell accepts human-readable commands from a user and converts them into something which the kernel can understand. The shell gets started when the user logs in or start the terminal. It is a command language interpreter that executes commands read from input devices such as keyboards or from the file system.

2. What are the types of permission at the file level in Shell?

Owner permissions: The permissions granted to a user with all the rights at the root level are known as Owner permissions.

Group permissions: The permissions granted to a user with all the rights in a particular group are known as Owner permissions.

Other (world) permissions: The permissions granted to a user with all the rights globally to a file system are known as Owner permissions.

3. What are the types of File Access Modes in Shell?

The permissions with respect to Linux operating systems are very unique. The fundamental blocks of Unix permissions in a file are the read, write, and execute permissions, which have been described below :

•Read: It gives a user with the authority to read the contents of the file.

•Write: It gives a user with the authority to write the content of the file.

•Execute: It gives a user with the authority to execute a file as a program.

4. What are the types of Directory Access Modes in Shell?

Directory access modes are similar to File Access Modes in a shell. There are very minute differences that are listed below:

•Read: It gives a user with the authority to read the contents of the directory and files within that space.

•Write: It gives a user with the authority to write and delete the contents of the Directory.

•Execute: There is no such thing as executing a Directory. It means we can only traverse within it.

5. What are the various stages of a Linux process it passes through?

Generally, there are four stages of a Linux process:

•Waiting: When resources aren’t given to a Linux process.

•Running: when the Linux process is currently being executed.

•Stopped: When the Linux process is stopped after successful execution.

•Zombie: This stage is known as a zombie because the process has stopped but still active.

6. How are shadow passwords given?

These are the programs that can be used initially to update the shadowed file; a pwconv command is used for giving shadow passwords. The pwconv command creates the file /etc/shadow and changes all passwords to ‘x’ in the /etc/passwd file. First, entries in the shadowed file which don’t exist in the main file are removed and these can be manually edited. Then, shadowed entries that don’t have `x’ as the password in the main file are updated. Missed shadowed entries can be added simultaneously. Finally, passwords in the main file are replaced with `x’. Shadow passwords are given for better system security.

7. What is a Kernel?

The kernel is a computer program that is the interface/resource manager of a computer’s operating system, with complete control over everything in the system. It is responsible for assigning and un-assigning memory space. It manages following resources of the Linux System are File management, Process management, I/O management, Memory management, Device management etc;

8. What is LILO?

LILO is Linux Loader is a boot loader for Linux. It is used to load Linux into the memory and start the Operating system. LILO can be configured to boot other operating systems as well. LILO is customizable, which means that if the default configuration is not correct, it can be changed. Config file for LILO is lilo.conf.

LILO is also a code snippet that loads PC BIOS into the main memory at the time of starting the computer system. It handles the following tasks :

•Locating the Linux kernel.

•Identifying other supporting programs and loading them in memory.

•Starting Kernel.

•The selection of various kernel images and boot routines is supported by LILO. For this reason, it is known as a boot manager.

9.What are the different types of commonly used shells on a typical Linux system?

csh,ksh,bash,Bourne . The most commonly used and advanced shell used today is “Bash”.

10. What is the equivalent of a file shortcut that we have a window on a Linux system?

Shortcuts are created using “links” on Linux. There are two types of links that can be used namely “soft link” and “hard link”.

11. What is the difference between soft and hard links?

Soft links are linked to the file name and can reside on different file systems as well; however hard links are linked to the inode of the file and have to be on the same filesystem as that of the file. Deleting the original file makes the soft link inactive (broken link) but does not affect the hard link (Hard link will still access a copy of the file).

12. How will you pass and access arguments to a script in Linux?

Arguments can be passed as:

scriptName “Arg1” “Arg2″….”Argn” and can be accessed inside the script as $1 , $2 .. $n

13. What is the significance of $#? What is the difference between $* and $@?

$# shows the count of the arguments passed to the script. $@ treats each quoted arguments as separate arguments but $* will consider the entire set of positional parameters as a single string.

14. Explain the “s” permission bit in a file?

“s” bit is called the “set user id” (SUID) bit.

“s” bit on a file causes the process to have the privileges of the owner of the file during the instance of the program.

For example, executing the “passwd” command to change current password causes the user to write its new password to the shadow file even though it has “root” as its owner.

15. How can any user find out all information about a specific user like his default shell, real-life name, default directory, when and how long he has been using the system?

finger “loginName” …where loginName is the login name of the

user whose information is expected.

16. What is the difference between $$ and $!?

$$ gives the process id of the currently executing process whereas $! Shows the process id of the process that recently went into the background.

17. What are zombie processes?

These are the processes which have died but whose exit status is still not picked by the parent process. These processes even if not functional still have its process id entry in the process table.

18. How will you copy a file from one machine to another?

We can use utilities like “ftp,” “scp” or “rsync” to copy a file from one machine to another.

E.g., Using ftp:

FTP hostname

>put file1

>bye

Above copies, file file1 from the local system to destination system whose hostname is specified.

19. I want to monitor a continuously updating log file, what command can be used to most efficiently achieve this?

We can use tail –f filename. This will cause only the default last 10 lines to be displayed on std o/p which continuously shows the updating part of the file.

20. How will you connect to a database server from Linux?

We can use isql utility that comes with open client driver as follows:

isql –S serverName –U username –P password

21. What are the 3 standard streams in Linux?

0 – Standard Input 1 – Standard Output 2 – Standard Error

22.  I want to read all input to the command from file1 direct all output to file2 and error to file 3, how can I achieve this?

command <file1 1>file2 2>file3

23. What will happen to my current process when I execute a command using exec?

“exec” overlays the newly forked process on the current process; so when I execute the command using exec, the command gets executed on the current shell without creating any new processes.

E.g., Executing “exec ls” on command prompt will execute ls and once ls exits, the process will shut down

24. Given a file find the count of lines containing the word “ABC”.

grep –c “ABC” file1

25. What is the difference between grep and egrep?

egrep is Extended grep that supports added grep features like “+” (1 or more occurrence of a previous character),”?”(0 or 1 occurrence of a previous character) and “|” (alternate matching).

26. What are the four fundamental components of every file system on Linux?

Bootblock, super block, inode block and Datablock are found fundamental components of every file system on Linux.

27. What is a boot block?

This block contains a small program called “Master Boot record”(MBR) which loads the kernel during system boot up.

28. What is a super block?

Super block contains all the information about the file system like the size of file system, block size used by its number of free data blocks and list of free inodes and data blocks.

29. What is an inode block?

This block contains the inode for every file of the file system along with all the file attributes except its name.

30. What are “c” and “b” permission fields of a file?

“c ” and “b” permission fields are generally associated with a device file. It specifies whether a file is a special character file or a block special file.

31. What is the use of a shebang line?

Shebang line at the top of each script determines the location of the engine which is to be used to execute the script.

GoLogica Technologies Private Limited. All rights reserved 2024.