Skip to content

Introduction to Bash Scripting ​

FieldValue
Module ID21
DifficultyEasy
TierTier 0
CategoryGeneral
Estimated Time5 hours
Cubes Earned0
Experience Points270
CreatorsCry0l1t3
Last Updated2020-12-16T00:00:00.000000Z
URLhttps://academy.hackthebox.com/app/module/21

Module Includes ​

  • 10 Sections
  • 9 Interactive Exercises
  • 0 Assessments
  • 0 Cubes

Module Description ​

This module covers the basics needed for working with Bash scripts to automate tasks on Linux systems. A strong grasp of Bash is a fundamental skill for anyone working in a technical information security role. Through the power of automation, we can unlock the Linux operating system's full potential and efficiently perform habitual tasks.

Module Summary ​

In this module, we will cover:

  • An introduction to Bash scripting
  • Conditional execution
  • Working with arguments, variables, and arrays
  • Comparison operators, arithmetic, and input/output control
  • Loops, branches, and functions
  • Techniques for debugging Bash scripts

This module is broken down into sections with accompanying hands-on exercises to practice each of the tactics and techniques we cover. The module ends with a practical hands-on skills assessment to gauge your understanding of the various topic areas.

As you work through the module, you will see example commands and command output for the various topics introduced. It is worth reproducing as many of these examples as possible to reinforce further the concepts introduced in each section. You can do this in the Pwnbox provided in the interactive sections or your own virtual machine.

You can start and stop the module at any time and pick up where you left off. There is no time limit or "grading," but you must complete all of the exercises and the skills assessment to receive the maximum number of cubes and have this module marked as complete in any paths you have chosen.

The module is classified as "Easy" but assumes a working knowledge of the Linux command line and an understanding of information security fundamentals.

A firm grasp of the following modules can be considered prerequisites for successful completion of this module:

  • Linux Fundamentals
  • Web Requests

Sections ​

10 sections - 9 Interactive

#GroupTypeTitle
1IntroductiontheoryBourne Again Shell
2Working ComponentsinteractiveConditional Execution
3interactiveArguments, Variables, and Arrays
4interactiveComparison Operators
5interactiveArithmetic
6Script ControlinteractiveInput and Output Control
7interactiveFlow Control - Loops
8interactiveFlow Control - Branches
9Execution FlowinteractiveFunctions
10interactiveDebugging

Conclusion ​

In this module, we covered key concepts necessary for automating tasks on Linux systems using Bash scripts.

Module Key Takeaways

  • Working with core Bash scripting concepts such as conditional execution, loops, branches, and functions
  • Assigning variables and introducing user arguments to our scripts
  • Working with arrays, comparison operators, and input/output control
  • An understanding of how to incorporate loops, branches, and functions to enhance our Bash scripts further
  • Debugging techniques that are useful when writing complex scripts