Updated March 23, 2023
Shell Scripting Interview Questions And Answers
Shell Scripting is a way by which one can alleviate this necessity by automating these command sequences to make one’s life in the shell more accessible and productive. Unix/Linux uses shells to accept commands given by the end-user; Shell Scripting Interview Questions there are quite a few different shells available.
The most commonly used shells are :
- SH(Bourne SHell)
- CSH(C SHell)
- KSH(Korn SHell)
- TCSH(Extended C SHell) based on CSH.
Now, if you are looking for a job that requires Shell Scripting, you must prepare for the 2023 Shell Scripting Interview Questions. Every interview is indeed different as per the various job profiles. Here, we have prepared the critical Shell Scripting Interview Questions and Answers, which will help you get success in your interview.
Below are the ten crucial 2023 Shell Scripting interview questions and answers frequently asked in an interview. These questions are categorized into two parts are as follows:
Part 1 – Shell Scripting Interview Questions (Basic)
This first part covers basic Shell Scripting Interview Questions And Answers.
1. What is a Kernel?
Answer: 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 the following resources of the Linux system –
- File management
- Process management
- I/O management
- Memory management
- Device management etc.
2. What is Shell?
Answer: A shell is a unique user program that provides an interface for users to use operating system services. Shell accepts human-readable commands from a user and converts them into something the kernel can understand. The shell gets started when the user logs in or starts the terminal.
A command language interpreter executes commands read from input devices such as keyboards or the file system.
Let us move to the following Shell Scripting Interview Questions.
3. What are the permission types at the file level in Shell?
- Owner permissions − The permissions granted to a user with all the rights at the root level are termed as Owner permissions.
- Group permissions − The permissions granted to a user with all the rights in a particular group are termed as Owner permissions.
- Other (world) permissions − The permissions granted to a user with all the rights globally to a file system termed as Owner permissions.
4. What are the types of File Access Modes in Shell?
Answer: The permissions concerning Linux operating systems are unique. The fundamental blocks of Unix permissions in a file are the read, write, and execute permissions, given in detail below-
- Read: It allows a user to read the file’s contents.
- Write: It gives users the authority to write the file’s content.
- Execute: It gives a user the authority to execute a file as a program.
5. What are the types of Directory Access Modes in Shell?
Answer: Directory access modes are similar to File Access Modes in a shell. Listed below are very minute differences–
- Read: It gives a user the authority to read the contents of the directory and files within that space.
- Write: It allows users to write and delete the directory’s contents.
- Execute: There is no such thing as executing a Directory. It means we can only traverse within it.
Part 2 – Shell Scripting Interview Questions (Advanced)
Let us now have a look at the advanced Shell Scripting Interview Questions.
6. What are the various stages of a Linux process it passes through?
Answer: Generally, there are four stages of a Linux process:
- Waiting: When resources aren’t given to a Linux process.
- Running: When Linux is currently executing the process.
- Stopped: When the Linux process is complete after successful execution.
- Zombie: This stage is known as a zombie because the process has stopped but is still active.
7. How are shadow passwords given?
Answer: These programs can initially update the shadowed file. The system uses the pwconv command to provide shadow passwords. The pwconv command creates the file /etc/shadow and changes all passwords in the /etc/password file to ‘x.’ To start, the programs remove entries in the shadowed file that don’t exist in the main file, which can then be manually edited. Next, the programs update shadowed entries that don’t have ‘x’ as the password in the main file. Any missed shadowed entries can also be added at the same time. Finally, the programs replace passwords in the main file with ‘x.’ Using shadow passwords improves system security.
Let us move to the following Shell Scripting Interview Questions.
8. What is LILO?
Answer: LILO is Linux Loader is a boot loader for Linux. LILO loads Linux into memory and starts the operating system. Additionally, it can be configured to boot other operating systems. Users can customize LILO to correct any default configurations that are not suitable. Config file for LILO is lilo.conf.
LILO is also a code snippet that loads PC BIOS into the main memory when starting the computer system. It handles the following tasks :
- Locating the Linux kernel.
- Identifying other supporting programs and loading them in memory.
- Starting Kernel.
LILO supports selecting various kernel images and boot routines and is also known as a boot manager.
9. Explain the Linux Directory commands along with the description?
Answer: Enlisted below are the directory commands along with descriptions
- pwd: It is a built-in command which stands for ‘print working directory. It displays the current working location, the working path starting with /, and the user’s directory. It shows the full path to the directory you are currently in.
- Is: This command lists out all the files in the directed folder.
- cd: This stands for ‘change directory.’ This command is mainly used to change the directory you want to work from the present directory. We must type the cd followed by the directory name to access that particular directory.
- mkdir: Major use in creating an entirely new directory.
- rmdir: Major use removes a directory from the system.
10. Enlist some Linux networking and troubleshooting commands?
Answer: A network administrator is a person who maintains a system network that includes networking configurations and troubleshooting. Mentioned below are a few commands, along with their description:
- Hostname: To see the machine’s hostname and set the current hostname.
- Ping: To inspect if the machine is responding or not.
- ifconfig: To visualize and manage routing and networking protocols. It displays network configuration. ‘ip’ is the replacement for the ifconfig command.
- netstat: It displays many network connections, routing tables, and interface statistics. Currently, ‘ss’ replaces the netstat command, which is used to get more information.
- Traceroute: A network troubleshooting utility determines the number of hops required for a particular packet to reach the destination.
- tracepath: It is similar to traceroute with the difference that it need not require root privileges.
- Dig: Major use of this command is to query the DNS name servers for any task/operations related to DNS lookup services.
- nslookup: To search for DNS related queries.
- Route: It shows the details of the route table files and the IP routing table.
- mtr: This command combines the ping and track path into a single command.
- Ifplugstatus: This command is used to check whether the network cable is plugged in.
These questions are just a few examples of what a Shell Scripting interview looks like. It is essential to have a good understanding of the basics of Shell Scripting and practical experience with creating and executing shell scripts in a Unix/Linux environment.
This has been a guide to List Of Shell Scripting Interview Questions and Answers. Here we have listed the best ten interview sets of questions so that the jobseeker can easily crack the interview. You may also look at the following articles to learn more.