Learning Linux Shell Scripting

Unleash the power of shell scripts to solve real-world problems by breaking through the practice of writing tedious code
Preview in Mapt
Code Files

Learning Linux Shell Scripting

Ganesh Sanjiv Naik

1 customer reviews
Unleash the power of shell scripts to solve real-world problems by breaking through the practice of writing tedious code
Mapt Subscription
FREE
$29.99/m after trial
eBook
$28.00
RRP $39.99
Save 29%
Print + eBook
$49.99
RRP $49.99
What do I get with a Mapt Pro subscription?
  • Unlimited access to all Packt’s 5,000+ eBooks and Videos
  • Early Access content, Progress Tracking, and Assessments
  • 1 Free eBook or Video to download and keep every month after trial
What do I get with an eBook?
  • Download this book in EPUB, PDF, MOBI formats
  • DRM FREE - read and interact with your content when you want, where you want, and how you want
  • Access this title in the Mapt reader
What do I get with Print & eBook?
  • Get a paperback copy of the book delivered to you
  • Download this book in EPUB, PDF, MOBI formats
  • DRM FREE - read and interact with your content when you want, where you want, and how you want
  • Access this title in the Mapt reader
What do I get with a Video?
  • Download this Video course in MP4 format
  • DRM FREE - read and interact with your content when you want, where you want, and how you want
  • Access this title in the Mapt reader
$0.00
$28.00
$49.99
$29.99p/m after trial
RRP $39.99
RRP $49.99
Subscription
eBook
Print + eBook
Start 30 Day Trial

Frequently bought together


Learning Linux Shell Scripting Book Cover
Learning Linux Shell Scripting
$ 39.99
$ 28.00
Linux Shell Scripting Bootcamp Book Cover
Linux Shell Scripting Bootcamp
$ 31.99
$ 22.40
Buy 2 for $35.00
Save $36.98
Add to Cart
Subscribe and access every Packt eBook & Video.
 
  • 5,000+ eBooks & Videos
  • 50+ New titles a month
  • 1 Free eBook/Video to keep every month
Start Free Trial
 

Book Details

ISBN 139781785286216
Paperback306 pages

Book Description

Linux is the one of the most powerful and universally adopted OSes. Shell is a program that gives the user direct interaction with the operating system. Scripts are collections of commands that are stored in a file. The shell can read this file and act on the commands as if they were typed on the keyboard. Shell scripting is used to automate day-to-day administration, and for testing or product development tasks.

This book covers Bash, GNU Bourne Again SHell, preparing you to work in the exciting world of Linux shell scripting. We start with an introduction to the Shell environment and explain basic commands used in Shell. Next we move on to check, kill, and control the execution of processes in Linux OS. Further, we teach you about the filter tools available in Linux and explain standard output and standard errors devices.

Then we will ensure you understand Shell’s interpretation of commands and get a firmer grasp so you use them in practice. Next, you’ll experience some real-world essentials such as debugging and perform Shell arithmetic fluently. Then you’ll take a step ahead and learn new and advanced topics in Shell scripting, such as starting up a system and customizing a Linux system. Finally, you’ll get to understand the capabilities of scripting and learn about Grep, Stream Editor, and Awk.

Table of Contents

Chapter 1: Getting Started and Working with Shell Scripting
Comparison of shells
Tasks done by shell
Working in shell
Learning basic Linux commands
Our first script – Hello World
Compiler and interpreter – difference in process
When not to use scripts
Various directories
Working more effectively with shell – basic commands
Working with permissions
Summary
Chapter 2: Drilling Deep into Process Management, Job Control, and Automation
Introducing process basics
Monitoring processes using ps
Process management
Process monitoring tools – top, iostat, and vmstat
Understanding "at"
Understanding "crontab"
Summary
Chapter 3: Using Text Processing and Filters in Your Scripts
Text filtering tools
IO redirection
Pattern matching with the vi editor
Pattern searching using grep
Summary
Chapter 4: Working with Commands
Learning shell interpretation of commands
Command substitution
Command separators
Logical operators
Pipes
Summary
Chapter 5: Exploring Expressions and Variables
Understanding variables
Working with environment variables
Working with read-only variables
Working with command line arguments (special variables, set and shift, getopt)
Understanding getopts
Understanding default parameters
Working with arrays
Summary
Chapter 6: Neat Tricks with Shell Scripting
Interactive Shell scripts – reading user input
The here document and the << operator
The here string and the <<< operator
File handling
Debugging
Summary
Chapter 7: Performing Arithmetic Operations in Shell Scripts
Using a command declare for arithmetic
Using the let command for arithmetic
Using the expr command for arithmetic
Binary, octal, and hex arithmetic operations
A floating-point arithmetic
Summary
Chapter 8: Automating Decision Making in Scripts
Checking the exit status of commands
Understanding the test command
Conditional constructs – if else
Switching case
Implementing simple menus with select
Looping with the for command
Exiting from the current loop iteration with the continue command
Exiting from a loop with a break
Working with the do while loop
Using until
Piping the output of a loop to a Linux command
Running loops in the background
The IFS and loops
Summary
Chapter 9: Working with Functions
Understanding functions
Passing arguments or parameters to functions
Sharing the data by many functions
Declaring local variables in functions
Returning information from functions
Running functions in the background
Creating a library of functions
Summary
Chapter 10: Using Advanced Functionality in Scripts
Understanding signals and traps
Using the trap command
Ignoring signals
Using traps in function
Running scripts or processes even if the user logs out
Creating dialog boxes with the dialog utility
Summary
Chapter 11: System Startup and Customizing a Linux System
System startup, inittab, and run levels
User initialization scripts
Summary
Chapter 12: Pattern Matching and Regular Expressions with sed and awk
The basics of regular expressions
sed – noninteractive stream editor
Using awk
Summary

What You Will Learn

  • Familiarize yourself with the various text filtering tools available in Linux
  • Combine the fundamental text and file processing commands to process data and automate repetitive tasks
  • Understand expressions and variables and how to use them practically
  • Automate decision-making and save a lot of time and effort of revisiting code
  • Get to grips with advanced functionality such as using traps and signals and using dialogs to develop screens
  • Start up a system and customize a Linux system
  • Take an in-depth look at regular expressions and pattern matching to understand the capabilities of scripting

Authors

Table of Contents

Chapter 1: Getting Started and Working with Shell Scripting
Comparison of shells
Tasks done by shell
Working in shell
Learning basic Linux commands
Our first script – Hello World
Compiler and interpreter – difference in process
When not to use scripts
Various directories
Working more effectively with shell – basic commands
Working with permissions
Summary
Chapter 2: Drilling Deep into Process Management, Job Control, and Automation
Introducing process basics
Monitoring processes using ps
Process management
Process monitoring tools – top, iostat, and vmstat
Understanding "at"
Understanding "crontab"
Summary
Chapter 3: Using Text Processing and Filters in Your Scripts
Text filtering tools
IO redirection
Pattern matching with the vi editor
Pattern searching using grep
Summary
Chapter 4: Working with Commands
Learning shell interpretation of commands
Command substitution
Command separators
Logical operators
Pipes
Summary
Chapter 5: Exploring Expressions and Variables
Understanding variables
Working with environment variables
Working with read-only variables
Working with command line arguments (special variables, set and shift, getopt)
Understanding getopts
Understanding default parameters
Working with arrays
Summary
Chapter 6: Neat Tricks with Shell Scripting
Interactive Shell scripts – reading user input
The here document and the << operator
The here string and the <<< operator
File handling
Debugging
Summary
Chapter 7: Performing Arithmetic Operations in Shell Scripts
Using a command declare for arithmetic
Using the let command for arithmetic
Using the expr command for arithmetic
Binary, octal, and hex arithmetic operations
A floating-point arithmetic
Summary
Chapter 8: Automating Decision Making in Scripts
Checking the exit status of commands
Understanding the test command
Conditional constructs – if else
Switching case
Implementing simple menus with select
Looping with the for command
Exiting from the current loop iteration with the continue command
Exiting from a loop with a break
Working with the do while loop
Using until
Piping the output of a loop to a Linux command
Running loops in the background
The IFS and loops
Summary
Chapter 9: Working with Functions
Understanding functions
Passing arguments or parameters to functions
Sharing the data by many functions
Declaring local variables in functions
Returning information from functions
Running functions in the background
Creating a library of functions
Summary
Chapter 10: Using Advanced Functionality in Scripts
Understanding signals and traps
Using the trap command
Ignoring signals
Using traps in function
Running scripts or processes even if the user logs out
Creating dialog boxes with the dialog utility
Summary
Chapter 11: System Startup and Customizing a Linux System
System startup, inittab, and run levels
User initialization scripts
Summary
Chapter 12: Pattern Matching and Regular Expressions with sed and awk
The basics of regular expressions
sed – noninteractive stream editor
Using awk
Summary

Book Details

ISBN 139781785286216
Paperback306 pages
Read More
From 1 reviews

Read More Reviews

Recommended for You

Mastering Python Regular Expressions Book Cover
Mastering Python Regular Expressions
$ 14.99
$ 10.50
Linux Shell Scripting Cookbook, Second Edition Book Cover
Linux Shell Scripting Cookbook, Second Edition
$ 26.99
$ 5.40
Python Machine Learning Book Cover
Python Machine Learning
$ 35.99
$ 25.20
Learning Docker Book Cover
Learning Docker
$ 39.99
$ 8.00
Mastering Object-oriented Python Book Cover
Mastering Object-oriented Python
$ 26.99
$ 18.90
Mastering Python Book Cover
Mastering Python
$ 31.99
$ 22.40