Learning Linux Shell Scripting
eBook - ePub

Learning Linux Shell Scripting

  1. 306 pages
  2. English
  3. ePUB (mobile friendly)
  4. Available on iOS & Android
eBook - ePub

Learning Linux Shell Scripting

Book details
Book preview
Table of contents
Citations

About This Book

Unleash the power of shell scripts to solve real-world problems by breaking through the practice of writing tedious code

About This Book

  • Learn how to efficiently and effectively build shell scripts and develop advanced applications with this handy book
  • Develop high quality and efficient solutions by writing professional and real-world scripts, and debug scripts by checking and shell tracing
  • A step-by-step tutorial to automate routine tasks by developing scripts from a basic level to very advanced functionality

Who This Book Is For

This book is ideal for those who are proficient at working with Linux and who want to learn about shell scripting to improve their efficiency and practical skills. By the end of this book, you will be able to confidently use your own shell scripts in the real world.

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

In Detail

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.

Style and approach

This practical book will go from the very basics of shell scripting to complex, customized automation. The idea behind this book is to be as practical as possible and give you the look and feel of what real-world scripting is like.

Frequently asked questions

Simply head over to the account section in settings and click on “Cancel Subscription” - it’s as simple as that. After you cancel, your membership will stay active for the remainder of the time you’ve paid for. Learn more here.
At the moment all of our mobile-responsive ePub books are available to download via the app. Most of our PDFs are also available to download and we're working on making the final remaining ones downloadable now. Learn more here.
Both plans give you full access to the library and all of Perlego’s features. The only differences are the price and subscription period: With the annual plan you’ll save around 30% compared to 12 months on the monthly plan.
We are an online textbook subscription service, where you can get access to an entire online library for less than the price of a single book per month. With over 1 million books across 1000+ topics, we’ve got you covered! Learn more here.
Look out for the read-aloud symbol on your next book to see if you can listen to it. The read-aloud tool reads text aloud for you, highlighting the text as it is being read. You can pause it, speed it up and slow it down. Learn more here.
Yes, you can access Learning Linux Shell Scripting by Ganesh Sanjiv Naik in PDF and/or ePUB format, as well as other popular books in Computer Science & Operating Systems. We have over one million books available in our catalogue for you to explore.

Information

Year
2015
ISBN
9781785286216
Edition
1

Learning Linux Shell Scripting


Table of Contents

Learning Linux Shell Scripting
Credits
About the Author
Acknowledgments
About the Reviewers
www.PacktPub.com
Support files, eBooks, discount offers, and more
Why subscribe?
Free access for Packt account holders
Preface
What this book covers
What you need for this book
Who this book is for
Conventions
Reader feedback
Customer support
Downloading the color images of this book
Errata
Piracy
Questions
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
Changing file permissions
Command chmod
Technique one – the symbolic method
Technique two – the numeric method
Setting umask
Setuid
Setgid
Sticky bit
Summary
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
3. Using Text Processing and Filters in Your Scripts
Text filtering tools
Head and tail
The diff command
The cut command
The paste command
The join command
The uniq command
The comm command
The tr command
IO redirection
File descriptors
Redirection
Brace expansion
Pattern matching with the vi editor
Pattern searching using grep
Summary
4. Working with Commands
Learning shell interpretation of commands
Checking and disabling shell internal commands
The exit status
Command substitution
Command separators
Command1; command2
Command grouping
Logical operators
Command1 & command2
Command1 && command2
Command1 || command2
Pipes
Summary
5. Exploring Expressions and Variables
Understanding variables
Working with environment variables
The local variable and its scope
Exporting variables
Working with read-only variables
Working with command line arguments (special variables, set and shift, getopt)
Understanding set
Understanding shift
Resetting positional parameters
Understanding getopts
Understanding default parameters
Working with arrays
Creating an array and initializing it
Accessing array values
Summary
6. Neat Tricks with Shell Scripting
Interactive Shell scripts – reading user input
Summarizing the read command with options
The here document and the << operator
The here operator with the sort command
The here operator with the wc command
The utility ed and here operator
A script for sending messages to all logged-in users
Using the << here operator for FTP usage and data transfer
Turning off variable substitution
The here string and the <<< operator
File handling
Introducing file handling
Using exec to assign file descriptor (fd) to file
Understanding the opening, writing, and closing of a file
Understanding reading from a file
Understanding reading and writing to a file
Using command read on file descriptor (fd)
Reading from one file and writing to another file
Displaying the file descriptor information from the /proc folder
File handling – reading line by line
Executing the command and storing the results in a file
Summarizing usage of the exec command
Debugging
Debugging mode – di...

Table of contents

  1. Learning Linux Shell Scripting