Linux shell Interview Questions

Get Technical Answers for Linux shell Interview Questions byLinux shell Developers, Advanced Technical Questions for Freshers and Experience Persons. Get Free Practical Tests.

1. What is a shell?

Ans: The shell acts as an interface between the user and the operating system. The shell consists of a single operating system that is Kernel this helps to run the scripts simultaneously. When the user enters the command using keyboards, the shell communicates with the kernel operating system and executes it, then displays the output to the users.

2. What do you mean by shell scripting?

Ans: Shell scripting is a series or sequence of Linux commands which are written in plain text format. Shell scripting in Linux is used to list various Linux commands instead of working with specific jobs or commands.

3. What is the importance of writing shell scripts?

Ans: Below are a few important points which explain the importance of writing shell script such as;

  • Linux shell script takes the inputs which are written by the user, stored them in a file, and displays output to the users.
  • With the help of shell scripting users can create their own commands.
  • This is very helpful in the automation of some tasks.
  • This is very useful to automate the system administration tasks.
  • Users can save time while writing the scripts.

4. List some of the common and mostly used Linux commands?

Command Description
Is directory this stores the files in the current
mkdir helps to change the home
rmdir this creates the text known as test
cp this removes the text file
rm this copies the test directory
mv files removes the test directory file
more time this helps to move the directory
touch checks and display the pages at a
cat this displays the content of a file
helps to create an empty file

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

Ans: There are 4 types of commonly used shells are used in the Linux system they are;

  • Bourne shell (Sh)
  • C shell (csh)
  • Korn shell (ksh)
  • Bourne again shell (bash)

Linux Shell Scripting Certification Training

  • Master Your Craft
  • Lifetime LMS & Faculty Access
  • 24/7 online expert support
  • Real-world & Project Based Learning

 

6. What are the differences between soft and hard links?

Ans: Soft links are nothing but links, they define the name and store them on different file systems.

Hard Link is also a type of link used to link the inode of the file system and stored on different file systems.

7. Shell programs are stored in which file?

Ans: Shell programs are stored in a file system known as “sh”.

8. What are the advantages of the C shell over the Bourne shell?

Ans: Below are the advantages of the C shell over the Bourne shell;

  • C shells are used to alias commands
  • In c shells, users can use their own commands. One more thing is that instead of using lengthy commands, you just need to use the file name.
  • C shell offers many command history features. Users can remember the previously used commands.
  • With the help of C shell, the user no needs to type the commands again and again.

Subscribe to our youtube channel to get new updates..!

 

9. Is a separate compiler required for executing a shell program?

Ans: A separate compiler is not required in Linux to execute any shell programs. The shell in Linux interprets the specific commands in the programs and executes the file systems.

10. When should shell programming or scripting not be used?

Ans: The below instances explain when you should not use shell programming or scripting; 

  • When you working on complex programs and write the entire processing payroll system.
  • Where you need to work with high-level productivity.
  • When users need to work with different software tools.

11. What are the two types of shell variables available? Explain in brief?

Ans: The two types of shell variables are available such as;

1. User-defined variables or system variables:

These are the standard system variables, generally, they are written with the help of CAPITAL letters.

For example, SHELL: this is Linux defined system variable, which is used to define the name of the working default shells.

2. User-defined variables: These types of variables are defined by users. These are defined with lower case letters.

For example, $ a= 50 where a is the lower case variable and 50 is the value assigned to a.

12. How are shell variables stored? Explain them with an example?

Ans: Generally, Linux variables are stored as string variables.

Example $ a=50

In the above example, a= 50 where 50 is stored in a variable called a, here a is not considered as a number. The string character can be defined between 1 and 0.

Linux Shell Scripting Certification Training

Weekday / Weekend Batches

 

13. Explain about file permission?

Ans: There are 3 types of file permissions available such as;

Permission weight
r-read file 4
W-write file 2
x-execute file 1

14. What are the different blocks of the file system? Explain to them in brief?

Ans: The 4 main block systems available in the Linux file system such as;

File systems

Block name Name of the block
1st block   Boot block
2nd block   super block
3rd block   Inode table
4th block   data block

Super block: this block is used to define the state of the file system.

Boot block: they define the starting of the file system. It mainly consists of boot strap loader programs.

Inode table: We already know that all the entities in Linux are treated as a file system. Information related to these file systems is stored in Inode tables.

Data block: this block consists of only file contents.

15. What are the three modes of operations of vi editor? Explain in brief?

Ans:

1. Command mode-> in this mode, all the command keys are pressed by a user and then interprets as an editor command.

2. Insert mode-> this type of mode allows users to insert new test types and also edit the existing text file.

3. ex-command mode system-> this type of mode allows users to insert the commands at the command line arguments.

Submit an interview question

Categories

Request for more information

Sachin
Sachin
Networking, OS, Salesforce & Sap
Am sachin I have worked with hkr trainings for more than 4 years .and our methodologies had been a practical suit for student culture and professionals. And I have trained more than 30 batches over the last 8 months. And I have great experience working with hkr trainings. Contact me with my LinkedIn and Twitter.

WhatsApp
To Top