Saturday, 5 October 2019

10 Top Unix Shell Scripting Interview Questions And Answers

1) What is Shell?

Ans: Shell is a command interpreter, which interprets the command which the user gives to the kernel. It can also be defined as an interface between a user and operating system.

2) What is Shell Scripting?

Ans: Shell scripting is nothing but series or sequence of UNIX commands written in a plain text file. Instead of specifying one job/command at a time, in shell scripting we give a list of UNIX commands like a to-do list in a file to execute it.

3) What is the Importance of writing Shell Scripts?

Ans: The points given below explain the importance of writing shell scripts.

Shell script takes input from the user, file and displays it on the screen.
Shell scripting is very useful in creating your own commands.
It is helpful in automating some tasks of the day to day life.
It is useful for automating system administration tasks.
Mainly it saves time.

4) What are the Advantages of C Shell over Bourne Shell?

Ans: The advantages of C Shell over Bourne Shell are:

C shell allows aliasing of commands i.e. a user can give any name of his choice to the command. This feature is mainly useful when a user has to type the lengthy command again and again. At that point of time, instead of typing a lengthy command a user can type the name that he has given.
C shell provides command history feature. C shell remembers the previously typed command. Thus, it avoids typing the command again and again.

5) How many shell scripts come with UNIX operating system?

Ans: There are approximately 280 shell scripts that come with the UNIX operating system.

6) What are the default permissions of a file when it is created?

Ans: 666 i.e. rw-rw-rw- is the default permission of a file when it is created.


7) What are Shell Variables?

Ans: Shell variables are the main part of shell programming or scripting. They mainly provide the ability to store and manipulate information within a shell program.


8) What is the lifespan of a variable inside a shell script?

Ans: The lifespan of a variable inside shell script is only until the end of execution.


9) Generally, each block in UNIX is how many bytes?

Ans: Generally, each block in UNIX is of 1024 bytes.

10) What is a file system?

Ans: The file system is a collection of files which contain related information of the files.

No comments:

Post a Comment

Thanks for your comments.