TechBeamersTechBeamers
  • Viral Tips 🔥
  • Free CoursesTOP
  • TutorialsNEW
    • Python Tutorial
    • Python Examples
    • C Programming
    • Java Programming
    • MySQL Tutorial
    • Selenium Tutorial
    • Selenium Python
    • Playwright Python
    • Software Testing Tutorial
    • Agile Concepts
    • Linux Concepts
    • HowTo Guides
    • Android Topics
    • AngularJS Guides
    • Learn Automation
    • Technology Guides
  • Top Interviews & Quizzes
    • SQL Interview Questions
    • Testing Interview Questions
    • Python Interview Questions
    • Selenium Interview Questions
    • C Sharp Interview Questions
    • Java Interview Questions
    • Web Development Questions
    • PHP Interview Questions
    • Python Quizzes
    • Java Quizzes
    • Selenium Quizzes
    • Testing Quizzes
    • HTML CSS Quiz
    • Shell Script Quizzes
  • ToolsHOT
    • Python Online Compiler
    • Python Code Checker
    • C Online Compiler
    • Review Best IDEs
    • Random Letter Gen
    • Random Num Gen
TechBeamersTechBeamers
Search
  • Viral Tips 🔥
  • Free CoursesTOP
  • TutorialsNEW
    • Python Tutorial
    • Python Examples
    • C Programming
    • Java Programming
    • MySQL Tutorial
    • Selenium Tutorial
    • Selenium Python
    • Playwright Python
    • Software Testing Tutorial
    • Agile Concepts
    • Linux Concepts
    • HowTo Guides
    • Android Topics
    • AngularJS Guides
    • Learn Automation
    • Technology Guides
  • Top Interviews & Quizzes
    • SQL Interview Questions
    • Testing Interview Questions
    • Python Interview Questions
    • Selenium Interview Questions
    • C Sharp Interview Questions
    • Java Interview Questions
    • Web Development Questions
    • PHP Interview Questions
    • Python Quizzes
    • Java Quizzes
    • Selenium Quizzes
    • Testing Quizzes
    • HTML CSS Quiz
    • Shell Script Quizzes
  • ToolsHOT
    • Python Online Compiler
    • Python Code Checker
    • C Online Compiler
    • Review Best IDEs
    • Random Letter Gen
    • Random Num Gen
Follow US
© TechBeamers. All Rights Reserved.
Linux TutorialsShell Script Quiz

Shell Script Quiz for Unix/Linux Geeks

Last updated: Mar 18, 2025 5:34 am
Harsh S.
By
Harsh S.
Harsh S. Avatar
ByHarsh S.
Hello, I'm Harsh, I hold a degree in Masters of Computer Applications. I have worked in different IT companies as a development lead on many large-scale...
Follow:
No Comments
3 months ago
Share
12 Min Read
SHARE

Hey Geeks! Welcome to the 2nd edition of our Shell Scripting Quiz 🎉. This quiz tests your shell scripting knowledge—from basic commands to real-time script execution—helping you improve your Unix/Linux skills.

Why learn shell scripting? It’s not just for job interviews—it automates tasks, boosts efficiency, and simplifies system administration. Whether it’s building projects, deploying builds, or managing servers, a shell script can handle it all. We’ve included key interview questions covering Ubuntu, RHEL, SUSE, SLES, CentOS, and more. Ready to test your skills? Let’s begin! 🚀

🔥 Shell Script Quiz for Unix/Linux Geeks

Answer Explanations

Here is the reasoning table with concise and accurate explanations:

Q#Correct AnswerClear and Simple Explanation
1this otherThe || (OR) operator means “run the next command only if the previous one fails.” The && (AND) operator means “run the next command only if the previous one succeeds.”
2test “$a” = “$b”The test command uses = to compare strings, while -eq is only for numbers.
3sleep 1 & echo $!$! gives the process ID (PID) of the last background command, which is sleep 1 &.
4platform=Linux; export platform; sh -c ‘echo $platform’export is required to make platform available in the subshell executed by sh -c.
5case Java in Java) echo Java;; esacThis correctly matches Java in a case statement and prints it.
6for n in one two three; do echo -n $n; doneThe -n option prevents newlines, printing the output as onetwothree.
7awk ‘NR==99’ file1awk prints only the 99th line by checking the line number with NR==99.
8sed -n ’10p’ filenameThe -n option tells sed to print only the 10th line.
9uptimeThe uptime command displays how long the system has been running.
10grep -c ‘ABC’ filenameThe -c option counts the occurrences of ABC in the file.
11umask 000A umask of 000 gives full read, write, and execute permissions to everyone.
12ps -p PID -o comm=This prints only the process name for the given PID.
13sed ’10~10 i\Python’ filenameInserts Python at every 10th line using sed.
14vi -R filenamevi -R opens the file in read-only mode.
15kill -9 PIDkill -9 forcefully stops the process with the given PID.
16Shell interprets commandsA shell is responsible for interpreting and executing commands in Linux.
17cshcsh (C shell) has syntax very different from the Bourne shell.
18Not suitable for scriptingcsh lacks robust scripting features, making it unreliable for automation.
19ExecuteThe execute (x) permission is required to enter a directory.
20Read and execute the fileWith 755 permissions, others can read and execute the file but cannot modify it.

We gave clear and simple the explanations. Let us know if you need any further clarification via comments.

✨ What did You Learn from this Shell Script Quiz?

The Shell Scripting Quiz is a great resource for software developers and testers working on Unix/Linux platforms. But that’s not all—we also have quizzes on Java, Python, Selenium, and other programming topics to help you sharpen your skills and prepare for interviews. Check out these popular ones:

1️⃣ Test your Basic Java Programming Skills
2️⃣ Test your Python Programming Knowledge
3️⃣ Explore the Concept of Java Native Access

We hope this quiz has helped you enhance your Linux shell scripting and OS knowledge. If you found it useful, drop a comment below! Your feedback helps us create more quizzes and improve existing ones with the latest updates.

Before we wrap up, here’s an inspiring quote from Linus Torvalds, the creator of Linux:

“I’ve never regretted not making Linux shareware. I really don’t like the ‘pay for use’ binary shareware programs.”

🔔 Want more content like this? Subscribe to our YouTube channel for tutorials, coding tips, and in-depth programming insights. Stay ahead in your tech journey! 🚀

👉 Subscribe Now and don’t forget to share this quiz with your friends!

Related

TAGGED:Basic Commands for BeginnersShell Script Basics SimplifiedUnix Commands and Concepts
Share This Article
Flipboard Copy Link
Subscribe
Notify of
guest

guest

0 Comments
Newest
Oldest
Inline Feedbacks
View all comments

List of Topics

Stay Connected

FacebookLike
XFollow
YoutubeSubscribe
LinkedInFollow

Subscribe to Blog via Email

Enter your email address to subscribe to latest knowledge sharing updates.

Join 1,011 other subscribers

Continue Reading

  • C++ Programming Quiz – Beginner LevelAug 28
  • Top 30 Linux Interview Questions for BeginnersSep 3
  • 30 Linux Questions – Online TestSep 4
  • Makefile Tutorial to Create Client-Server ProgramSep 6
  • Essential Linux Questions for Better ResultsSep 7
  • Set Static IP on Windows, Ubuntu & OS XJun 16
  • Simple Steps to Create a Service in LinuxJul 10
  • Learn to Implement C++ Class in C ProgrammingJul 21
  • How to Use GDB with Six Debugging TipsAug 3
  • Ant Script to Change System Date-TimeAug 5
View all →

RELATED TUTORIALS

Linux Commands Cheat Sheet for Daily Reference

Easy to Recall Linux Commands Cheat Sheet

By Harsh S.
12 months ago
C++ Programming Quiz for Beginners

C++ Programming Quiz – Beginner Level

By Meenakshi Agarwal
3 months ago
Linux Interview Questions and Answers for Beginners

Top 30 Linux Interview Questions for Beginners

By Meenakshi Agarwal
9 months ago
Linux Commands for Beginners With Examples

Basic Linux Commands for Beginners

By Meenakshi Agarwal
3 months ago
© TechBeamers. All Rights Reserved.
  • About
  • Contact
  • Disclaimer
  • Privacy Policy
  • Terms of Use
wpDiscuz