Shell Scripting Interview Questions And Answers

Download Shell Scripting Interview Questions and Answers PDF

Refine your Shell Scripting interview skills with our 30 critical questions. Our questions cover a wide range of topics in Shell Scripting to ensure you're well-prepared. Whether you're new to the field or have years of experience, these questions are designed to help you succeed. Get the free PDF download to access all 30 questions and excel in your Shell Scripting interview. This comprehensive guide is essential for effective study and confidence building.

30 Shell Scripting Questions and Answers:

Shell Scripting Job Interview Questions Table of Contents:

Shell Scripting Job Interview Questions and Answers
Shell Scripting Job Interview Questions and Answers

1 :: What are PIDs?

They are process IDs given to processes. A PID can vary from 0 to 65535.
Read More

2 :: How do you send a mail message to somebody?

mail somebody@globalguideline.com -s ‘Your subject’ -c ‘ cc@globalguideline.com‘
Read More

3 :: How do you remove a file?

rm
Read More

4 :: How do you remove recursively?

rm -rf
Read More

5 :: How do you find out your own username?

whoami
Read More

6 :: How do you count words, lines and characters in a file?

wc
Read More

7 :: How do you search for a string inside a given file?

grep string filename
Read More

8 :: How do you search for a string inside a directory?

grep string *
Read More

9 :: How do you search for a string in a directory with the subdirectories recursed?

grep -r string *
Read More

10 :: How do you list currently running process?

ps
Read More

11 :: How do you find out what’s your shell?

echo $SHELL
Read More

12 :: How do you fire a process in the background?

./process-name &
Read More

13 :: How do you refer to the arguments passed to a shell script?

, and so on. {xtypo_info}$1, $2 and so on. $0 is your script name.{/xtypo_info} is your script name.
Read More

14 :: What’s the conditional statement in shell scripting?

if {condition} then … fi
Read More

15 :: How do you do number comparison in shell scripts?

-eq, -ne, -lt, -le, -gt, -ge
Read More

16 :: How do you test for file properties in shell scripts?

-s filename tells you if the file is not empty, -f filename tells you whether the argument is a file, and not a directory, -d filename tests if the argument is a directory, and not a file, -w filename tests for writeability, -r filename tests for readability, -x filename tests for executability
Read More

17 :: How do you do Boolean logic operators in shell scripting?

! tests for logical not, -a tests for logical and, and -o tests for logical or.
Read More

18 :: How do you find out the number of arguments passed to the shell script?

$#
Read More

19 :: What’s a way to do multilevel if-else’s in shell scripting?

if {condition} then {statement} elif {condition} {statement} fi
Read More

20 :: How do you write a for loop in shell?

for {variable name} in {list} do {statement} done
Read More

21 :: How do you find out the current directory you’re in?

pwd
Read More

22 :: What’s the command to find out users on the system?

who
Read More

23 :: What’s the command to find out today’s date?

date
Read More

24 :: How do you stop a process?

kill pid
Read More

25 :: How do you find out about all running processes?

ps -ag
Read More