Sign In Start Free Trial
Account

Add to playlist

Create a Playlist

Modal Close icon
You need to login to use this feature.
  • Book Overview & Buying The Ultimate Linux Shell Scripting Guide
  • Table Of Contents Toc
The Ultimate Linux Shell Scripting Guide

The Ultimate Linux Shell Scripting Guide

By : Donald A. Tevault
4.9 (7)
close
close
The Ultimate Linux Shell Scripting Guide

The Ultimate Linux Shell Scripting Guide

4.9 (7)
By: Donald A. Tevault

Overview of this book

Dive into the world of Linux shell scripting with this hands-on guide. If you’re comfortable using the command line on Unix or Linux but haven’t fully explored Bash, this book is for you. It’s designed for programmers familiar with languages like Python, JavaScript, or PHP who want to make the most of shell scripting. This isn’t just another theory-heavy book—you’ll learn by doing. Each chapter builds on the last, taking you from shell basics to writing practical scripts that solve real-world problems. With nearly a hundred interactive labs, you’ll gain hands-on experience in automation, system administration, and troubleshooting. While Bash is the primary focus, you'll also get a look at Z Shell and PowerShell, expanding your skills and adaptability. From mastering command redirection and pipelines to writing scripts that work across different Unix-like systems, this book equips you for real-world Linux challenges. By the end, you'll be equipped to write efficient shell scripts that streamline your workflow and improve system automation.
Table of Contents (27 chapters)
close
close
26
Index

To get the most out of this book

Since the book begins with the very basics of Linux and Unix command-line usage, the reader really just needs to be comfortable with the idea of setting up VirtualBox and installing Linux, FreeBSD, and OpenIndiana virtual machines.

VirtualBox is a free download that you can get from here: https://www.virtualbox.org/

To run VirtualBox, you’ll need a machine with a CPU that is capable of virtualization. Most modern CPUs have that capability, with the exception of certain Intel Core i3 and Core i5 models. (That’s because they lack the hardware acceleration that’s required for virtualization.) Also, you’ll have to ensure that virtualization is enabled in your computer’s BIOS.

For the demos, we’ll be using Fedora, Debian, Ubuntu, FreeBSD, and OpenIndiana virtual machines. Here’s where you can download the installation images:

In all cases, you’ll need to create a normal user account that has full sudo privileges. That happens automatically with Ubuntu and OpenIndiana during installation. With Debian and Fedora, that will happen automatically if you omit creating a root user password during installation.

For FreeBSD, things are a bit different. That’s because the FreeBSD installer will have you create a password for the root user, and sudo won’t be installed. So, here’s the procedure for installing FreeBSD.

  1. When you get to the installer section that has you create your own user account, you’ll see:
    1. Login group is your_username. Invite your_username into other groups.
    2. Respond by typing wheel, in order to add yourself to the wheel group.
  2. After the installation has completed, log into the root user account, using the password that you created during installation.
  3. Install the sudo package by doing:
    pkg install sudo
    
  4. Configure sudo so that members of the wheel group have full sudo privileges. Begin by entering the command:
    visudo
    
  5. Scroll down to where you see this line:
    # %wheel ALL=(ALL:ALL) ALL
    
    • Remove the # and the leading blank space from in front of this line.
    • Save the file and exit.
  6. Log out from the root user's account, and log back in with your own account.

When you need to perform an administrative command, you can now use sudo, as you would on any Linux distro.

Next, you’ll need to install bash on FreeBSD.

Since bash doesn’t come installed on FreeBSD by default, you’ll need to install it yourself. Here’s the procedure:

  1. Install bash with this command:
    sudo pkg install bash
    
  2. Create a symbolic line to the bash executable, like this:
    sudo ln -s /usr/local/bin/bash /bin/bash
    

Download the example code files

The code bundle for the book is hosted on GitHub at https://github.com/PacktPublishing/The-Ultimate-Linux-Shell-Scripting-Guide.git. We also have other code bundles from our rich catalog of books and videos available at https://github.com/PacktPublishing/. Check them out!

Download the color images

We also provide a PDF file that has color images of the screenshots/diagrams used in this book. You can download it here: https://packt.link/gbp/9781835463574.

Conventions used

There are a number of text conventions used throughout this book.

CodeInText: Indicates code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles. For example: “Add the new functions to the /etc/bashrc file.”

donnie@opensuse:~> git clone https://github.com/PacktPublishing/The-Ultimate-Linux-Shell-Scripting-Guide.git

Bold: Indicates a new term, an important word, or words that you see on the screen. For instance, words in menus or dialog boxes appear in the text like this. For example: “ First, let’s see how many processes are in either the Running state or the Zombie state.”

Warnings or important notes appear like this.

Tips and tricks appear like this.

CONTINUE READING
83
Tech Concepts
36
Programming languages
73
Tech Tools
Icon Unlimited access to the largest independent learning library in tech of over 8,000 expert-authored tech books and videos.
Icon Innovative learning tools, including AI book assistants, code context explainers, and text-to-speech.
Icon 50+ new titles added per month and exclusive early access to books as they are being written.
The Ultimate Linux Shell Scripting Guide
notes
bookmark Notes and Bookmarks search Search in title playlist Add to playlist download Download options font-size Font size

Change the font size

margin-width Margin width

Change margin width

day-mode Day/Sepia/Night Modes

Change background colour

Close icon Search
Country selected

Close icon Your notes and bookmarks

Confirmation

Modal Close icon
claim successful

Buy this book with your credits?

Modal Close icon
Are you sure you want to buy this book with one of your credits?
Close
YES, BUY

Submit Your Feedback

Modal Close icon
Modal Close icon
Modal Close icon