Linux Shell Scripting

Linux Shell Scripting Question and answers that can help you to prepare for different Linux Interviews

Q.1 According to you, what is the need to connect the system to remote server, in UNIX shell scripting?
The need to connect the system to remote server, in UNIX shell scripting is when it comes to executing some special commands and the users are free to get this done through various commands. This helps the users to get an additional control or to get some additional support or help. But the approach has to be secured with an authentication process which can be a simple username and a password.
Q.2 What is the function of utilities that come with the open client driver in the shell scripting?
They are considered useful for connecting the system with a database server simply. Such that the users have no performed this task to accomplish so many tasks that are relevant and important in scripting. Since scripting requires a lot of data and information and it are not always possible that the same is kept at a particular location only. Here the users are required to ensure of an error-free outcome in this approach.
Q.3 What do you understand by MBR in the shell scripting and why is it considered useful for the users?
MBR is abbreviated as Master Boot Record which is a small program whose prime function is to ensure that the kernel is loaded during the system boot set up. It is present in the boot block. The MBR is considered useful because it makes sure that the users can perform the boot looping tasks accurately and reliably.
Q.4 Let us suppose you have been asked execute a command using exec, then what will be the status of your current process in the shell?
Given the above scenario, all the forked processes which are new get overlays when the 'exec' is executed. This command simply gets executed without making any impact on the current process. Such that no new process will be created in this scenario.
Q.5 How do you define a shell?
Shell is a defined interface between the user and the kernel. Although there can be only one kernel; a system can have many shell running simultaneously. Therefore when a user enters a command through the keyboard, the shell communicates with the kernel to execute it and then display the output to the user.
Q.6 In a Linux system, what are the different kinds of commonly used shells?
The different kinds of commonly used shells are csh,ksh,bash,Bourne . One opf the most commonly used and advanced shell used today is "Bash" .
Q.7 Differentiate between soft and hard links.
The key point of difference between soft and hard links are - The soft links are link to the file name and can reside on different filesytem as well; on the other hand, hard links are link to the inode of the file and have to be on the same filesytem as that of the file. Such that 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)
Q.8 What is the importance of $#?
$# represents the count of the arguments passed to the script.
Q.9 Differentiate between $* and $@
$@ considers each quoted arguments as separate arguments whereas $* will consider the entire set of positional parameters as a single string
Q.10 What do you understand by zombie processes?
Zombie processes are the processes that have died but there exit status is still not picked by the parent process. Zombies processes even if not functional still have its process ID entry in the process table.
Q.11 What do you understand by shell in terms of scripting?
We can define shell in terms of scripting as a direct link among the kernel and the user. Such that it is possible for the system to run multiple shells at the same time irrespective of the fact that there is always only one kernel that remains present. Therefore when a command is given by the user, shell begins exchanging information with the kernel, wherein the operations are then executed and the information is conveyed to the user.

Some of the commonly used shells in scripting are ksh, bourne,bash, csh
Q.12 How can you create shortcut in the Linux?
We can create shortcuts with the help of links present in the UNIX. There are two links which are considered which are generally categorized as,
1. Soft Link
2. Hard Link
Q.13 Give a brief about the Super Block in Shell scripting.
Super Block in Shell scripting is basically a program containing all the information with reference to a specific file system. Super Block reflects the block size that is used by its associated number, the size of system in terms of data handling and programming. This also provides information regarding the free inodes and the data blocks which are currently associated with the system.
Q.14 What is the possibility to pass arguments to the scripts when the same in running in the UNIX?
It is possible to pass arguments to the scripts ehile running in UNIX such that it is followed often. This is done to ensure that the system does not have any error while executing the command and also the scripts are running smoothly.
Q.15 What are the crucial standard streams in the UNIX shell scripting?
The crucial standard streams in the UNIX shell scripting are Standard Input, Standard Output as well as Standard Error
Q.16 How can we calculate the overall number of arguments which are passed to a script and why is it important?
We can calculate the overall number of arguments that are passed to a script by a command $#. Also the same is required to know the overall load on a script. Also every limit has a limit on handling the same and users have to check it often to ensure script remains in the running mode and does not get fail.
Q.17 What will you do to treat the quoted arguments as separate ones from the general?
We can treat the quoted arguments as separate ones from the general using the command $@. It is possible to treat them as a single entity using the command $* can be applied directly.
Q.18 How can you display the process ID of the process executing currently and ID of processes that take place recently, in shell scripting?
We can display the process ID of the process executing currently and ID of processes that take place recently, in shell scripting by using two dedicated commands that can be executed directly and they are namely, $$ and $.
Q.19 What is the importance of Shebang line, in shell scripting, ?
Shebang line provides information regarding the location where the engine is placed such that the engine is the one that execute the script. Shebang line is present at the top of the script and it can be ignored by the users if they want to.
Get Govt. Certified Take Test