Linux Shell Scripting Cookbook, Second Edition and over 2 million other books are available for Amazon Kindle . Learn more

Sign in to turn on 1-Click ordering.
Trade in Yours
For a 7.66 Gift Card
Trade in
More Buying Choices
Have one to sell? Sell yours here
Sorry, this item is not available in
Image not available for
Image not available

Start reading Linux Shell Scripting Cookbook, Second Edition on your Kindle in under a minute.

Don't have a Kindle? Get your Kindle here, or download a FREE Kindle Reading App.

Linux Shell Scripting Cookbook, Second Edition [Paperback]

Shantanu Tushar
5.0 out of 5 stars  See all reviews (2 customer reviews)
Price: 27.99 & FREE Delivery in the UK. Details
o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o
In stock.
Dispatched from and sold by Amazon. Gift-wrap available.
Want it tomorrow, 25 July? Choose Express delivery at checkout. Details


Amazon Price New from Used from
Kindle Edition 17.50  
Paperback 27.99  
Trade In this Item for up to 7.66
Trade in Linux Shell Scripting Cookbook, Second Edition for an Amazon Gift Card of up to 7.66, which you can then spend on millions of items across the site. Trade-in values may vary (terms apply). Learn more

Book Description

21 May 2013 1782162747 978-1782162742 2nd New edition

Over 110 practical recipes to solve real-world shell problems, guaranteed to make you wonder how you ever lived without them


  • Master the art of crafting one-liner command sequence to perform text processing, digging data from files, backups to sysadmin tools, and a lot more
  • And if powerful text processing isn't enough, see how to make your scripts interact with the web-services like Twitter, Gmail
  • Explores the possibilities with the shell in a simple and elegant way - you will see how to effectively solve problems in your day to day life

In Detail

The shell remains one of the most powerful tools on a computer system — yet a large number of users are unaware of how much one can accomplish with it. Using a combination of simple commands, we will see how to solve complex problems in day to day computer usage.

Linux Shell Scripting Cookbook, Second Edition will take you through useful real-world recipes designed to make your daily life easy when working with the shell. The book shows the reader how to effectively use the shell to accomplish complex tasks with ease.

The book discusses basics of using the shell, general commands and proceeds to show the reader how to use them to perform complex tasks with ease.

Starting with the basics of the shell, we will learn simple commands with their usages allowing us to perform operations on files of different kind. The book then proceeds to explain text processing, web interaction and concludes with backups, monitoring and other sysadmin tasks.

Linux Shell Scripting Cookbook, Second Edition serves as an excellent guide to solving day to day problems using the shell and few powerful commands together to create solutions.

What you will learn from this book

  • Explore a variety of regular usage tasks and how it can be made faster using shell command
  • Write shell scripts that can dig data from web and process it with few lines of code
  • Use different kinds of tools together to create solutions
  • Interact with simple web API from scripts
  • Perform and automate tasks such as automating backups and restore with archiving tools
  • Create and maintain file/folder archives, compression formats and encrypting techniques with shell
  • Set up Ethernet and Wireless LAN with the shell script
  • Monitor different activities on the network using logging techniques


This book is written in a Cookbook style and it offers learning through recipes with examples and illustrations. Each recipe contains step-by-step instructions about everything necessary to execute a particular task. The book is designed so that you can read it from start to end for beginners, or just open up any chapter and start following the recipes as a reference for advanced users.

Who this book is written for

This book is both for the casual GNU/Linux users who want to do amazing things with the shell, and for advanced users looking for ways to make their lives with the shell more productive.

You can start writing scripts and one-liners by simply looking at the similar recipe and its descriptions without any working knowledge of shell scripting or Linux. Intermediate/advanced users as well as system administrators/ developers and programmers can use this book as a reference when they face problems while coding.

Product details

  • Paperback: 384 pages
  • Publisher: Packt Publishing; 2nd New edition edition (21 May 2013)
  • Language: English
  • ISBN-10: 1782162747
  • ISBN-13: 978-1782162742
  • Product Dimensions: 2 x 18.8 x 23.1 cm
  • Average Customer Review: 5.0 out of 5 stars  See all reviews (2 customer reviews)
  • Amazon Bestsellers Rank: 804,792 in Books (See Top 100 in Books)

More About the Authors

Discover books, learn about writers, and more.

Product Description

About the Author

Shantanu Tushar

Shantanu Tushar is an advanced GNU/Linux user since his college days. He works as an application developer and contributes to the software in the KDE projects.

Shantanu has been fascinated by computers since he was a child, and spent most of his high school time writing C code to perform daily activities. Since he started using GNU/Linux, he has been using shell scripts to make the computer do all the hard work for him. He also takes time to visit students at various colleges to introduce them to the power of Free Software, including its various tools. Shantanu is a well-known contributor in the KDE community and works on Calligra, Gluon and the Plasma subprojects. He looks after maintaining Calligra Active – KDE's office document viewer for tablets, Plasma Media Center, and the Gluon Player. One day, he believes, programming will be so easy that everybody will love to write programs for their computers.

Shantanu can be reached by e-mail on, shantanutushar on, or his website

Sarath Lakshman

Sarath Lakshman is a 23 year old who was bitten by the Linux bug during his teenage years. He is a software engineer working in ZCloud engineering group at Zynga, India. He is a life hacker who loves to explore innovations. He is a GNU/Linux enthusiast and hactivist of free and open source software. He spends most of his time hacking with computers and having fun with his great friends. Sarath is well known as the developer of SLYNUX (2005)—a user friendly GNU/Linux distribution for Linux newbies. The free and open source software projects he has contributed to are PiTiVi Video editor, SLYNUX GNU/Linux distro, Swathantra Malayalam Computing, School-Admin, Istanbul, and the Pardus Project. He has authored many articles for the Linux For You magazine on various domains of FOSS technologies. He had made a contribution to several different open source projects during his multiple Google Summer of Code projects. Currently, he is exploring his passion about scalable distributed systems in his spare time. Sarath can be reached via his website

Inside This Book (Learn More)
Browse Sample Pages
Front Cover | Copyright | Table of Contents | Excerpt | Index | Back Cover
Search inside this book:

What Other Items Do Customers Buy After Viewing This Item?

Customer Reviews

4 star
3 star
2 star
1 star
5.0 out of 5 stars
5.0 out of 5 stars
Most Helpful Customer Reviews
2 of 2 people found the following review helpful
5.0 out of 5 stars Solving Practical Problems with the bash shell 5 Aug 2013
Format:Kindle Edition
This book introduces the bash shell and many of the linux utilities that can be run from the bash prompt. I would regard the book as a supplement to the manuals for bash and the utilities. These manuals are available on the web and contain comprehensive details of the syntax of bash commands/utilities and of various options available. These manuals contain so much detail that a less experienced user will be unable to understand what is important or what can be done because he has been overloaded with detail.

This book is a solution to this overload problem. It
* provides an often simplified introduction to the bash shell and to individual bash commands and utilities and
* poses a series of practical problems and provides recipes (bash scripts which combine bash commands and utilities) which solve these problems.

A recipe on page 210 provides an illustration of this process. It is a bash script using various bash commands and lynx and cURL utilities to check a web site for broken links. I had an immediate use for this script and it solved my problem. Until I had read this book I would not have considered using the bash shell to solve some of these problems. The book has definitely increased my understanding of the bash shell.

The recipes are presented in Chapters which cover 1. Introduction, 2. Commonly used Commands, 3. Managing Files, 4. Working with text files, 5. Managing the web from the Command line (I found this a most interesting section and the overviews of wget and cURL are good), 6. Backup facilities, 7. Networking, 8. Monitoring the use of the system and 9. Administration. A user like myself will probably not need all of this material.
Read more ›
Comment | 
Was this review helpful to you?
1 of 1 people found the following review helpful
5.0 out of 5 stars More than foo and bar 24 Jun 2013
Linux Shell Scripting Cookbook, Second Edition
For those who want to work at the Linux command line and be able to streamline and automate tedious tasks this book if for you; it is well written and easy to read removing the tedium of having the read a book; moreover, it has not fallen into the trap of using hypothetical examples with foo and bar. The examples are all real and practical that you can use straight away. You will start the book and in moments you will be putting it down to test the examples they use. This will be a book you should have read years ago.

If you find there are areas you already know, do not fear, the book does not require to be read in order and from front to back. Each page you turn you will find examples you can use or are already using. The book will start with some shell basics such as using echo and "hello world" but quickly moves on to using color with echo to make the output of your scripts more readable and context orientated messages. The humor that is included too adds to the ease in which this can be read, taking what could be quite dry into and enjoyable read. You will see this yourself within the chapter titles as well as their tips.

The book is more about the commands that you can use and how to use them, Linux commands are your tool chest and the authors show you the full power of the tools that you own. Chapter has a goodly list of commands with useful examples where they may be used leading into file and output redirection in chapter 3. By this stage I guarantee you will be liking the book and already tried more than a a dozen of their examples out. DO USE this book with a Linux terminal by your side, you will want to practice.
Read more ›
Comment | 
Was this review helpful to you?
Most Helpful Customer Reviews on (beta) 4.5 out of 5 stars  6 reviews
8 of 8 people found the following review helpful
5.0 out of 5 stars A book you should have handy when starting Linux shell scripting 23 Jun 2013
By Pierre - Published on
I have started using Linux in 2000 with Suse Linux. Coming from Windows Linux right away took my interest especially the tremendous freedom it gives you and the ability to operate the system instead of being operated by the system. But if you want to get into the depth of Linux and being an expert the learning curve especially when starting is quite steep and the huge amount of possibilities is hard to tackle. But if you go over this hurdle than you get rewarded with the knowledge of how to rule your computer. You can do it the hard way as I did when starting with Linux by asking Google for each and every question coming up. But if you want to accelerate to get into understanding and using Linux not only on the surface than this book is for you.

The book is precisely focused on shell scripting and is therefore always right to the point. So you won't find information on how to install Linux but as this is one of the easier parts you can find a lot of good information on the internet and nowadays setting up a Linux machine is quite easy.

If you have Linux installed this book helps you to jump right into the topic. In the introduction of chapter 1 you get the basics about the shell environment you need just enough to start scripting. For example it is explained what does the prompt look like, the structure of a shell script and how to start it. And some handy information to avoid unnecessary typing using the history.

After the introduction of each chapter the book starts with recipes. Each recipe is introduced with a short objective of a recipe and then it has more or less always the same structure. Getting ready gives a brief overview of the commands and syntax used in the following sections. How to do it shows how the commands are used that support the objective. The explanation is done on practical and real life examples that can be used in your day to day work. In some recipes you get also deeper information in the But there is more section that can be skipped at a first read and referenced later when topic comes up in combination with other recipes.

As this book's title denotes the content is presented as a cookbook. In a cookbook you can assume to jump into a specific topic and than just program along. But I would recommend before starting to read the first chapter as it explains all basic elements of a shell script like variable assignment, arrays, functions and other programming structures as well as debugging tools and strategies. After chapter 1 you have enough information to tackle the recipes in following chapters.

Chapter 2 and chapter 3 provide a comprehensive set of recipes on file manipulation. Chapter 2 is more focused on recipes you will need in your day to day work, like finding, copying and moving files. Chapter 3 has more sophisticated recipes like file comparison to find out the differences between two files.

Chapter 4 is about the content of files, that is finding and manipulating the content of a file. The chapter starts with an introduction into regular expressions and some often used patterns like e-mail address validation are provided.

Especially interesting to me was chapter 5 which goes beyond the Linux operating system but shows how to use shell scripting for accessing the web. I liked the recipe about cURL, a very sophisticated and comprehensive tool for accessing the web through a lot of different web protocols. This recipe gives you a kick start into cURL with the commands you will use 80% of your time when down or uploading files from or to the web or another file system.

The book does not only cover topics you would need as a regular Linux user but also provides recipes for administration tasks. And from my experience the book covers the main commands that you would need to administer your private Linux home network to keep it up and running. The chapters 6, 8 and 9 cover backup tools, tools for monitoring you system and manipulating or running automatically scheduled processes with cron jobs.

And finally chapter 7 has a lot to say about setting up a network. The topics cover file transfer between computers or logging in to remote computers using ssh.

If you are a programmer of a programming language that uses a lot the Linux shell like Python, Ruby or Ruby on Rails than I also can recommend this book. It covers the topics you will need when mainly working with the console and not using an IDE. Especially useful I consider in this regard the topics how to find files, how to compare files, how to find a specific content of a file that you need to refactor. SSH without login is also very useful when working with Ruby on Rails and administrating an application server like passenger. Also the brief introduction into Git serves as a good start into managing and archiving your source files like the scripts you generate based on the knowledge gained from the book. The section finding broken links on a web site is very helpful when working as a web developer.

So all in all this book is a very helpful companion whether you are using Linux as a regular user or as an administrator. And if you are a developer you find a lot of valuable commands and recipes that make your programming life easier. It is a book you should have handy when you are one of the above mentioned users to make your life easier with Linux.
2 of 2 people found the following review helpful
5.0 out of 5 stars Great Book 19 Mar 2014
By T. Williams - Published on
This is one of the best books I have read on Linux scripting. Shantanu, has a straight to the point no fluff writing style. It was straight forward and I was able to read this book in two days because of it. It felt good not having to waste my time with page "filler's" as I have done with most technical books. I commend Shantanu on his efforts and I hope that other ( IT) technical writers take note.
1 of 1 people found the following review helpful
2.0 out of 5 stars Author is completely confused 1 Jun 2014
By srinivas - Published on
Format:Kindle Edition|Verified Purchase
Book is not written an very ordered manner. Its like a bit and pieces. For beginners its too confusing.
Concepts has to be explained.
1 of 1 people found the following review helpful
5.0 out of 5 stars Very good beginner's guide 7 Oct 2013
By Gregory T. Laden - Published on
Format:Kindle Edition
I just finished "Linux Shell Scripting Cookbook" (Second Edition) by Shantanu Tushar and Sarath Lakshman. This is a beginner's guide to using shell scripting (bash) on linux.

Usually, a "cookbook" is set up more like a series of projects organized around a set of themes, and is usually less introductory than this book. "Linux Shell Scripting Cookbook" might be better titled "Introduction to Linux Shell Scripting" because it is more like a tutorial and a how too book than like a cookbook. Nonetheless, it is an excellent tutorial that includes over 100 "recipes" that address a diversity of applications. It's just that they are organized more like a tutorial. What this means is that a beginner can use only the resources in this book and get results. The various recipes are organized in an order that brings the reader through basics (like how to use the terminal, how to mess with environment variables, etc.) then on to more complex topics such as regular expressions, manipulating text, accessing web pages, and archiving. One very nice set of scripts that is not often found in intro books addresses networking. The book also covers MySQL database use.

All of the scripts are available from the publisher in a well organized zip archive.

I read the e-version of the book, in iBooks, but the PDF version is very nice as well. I don't know how this would translate as at Kindle book. But, importantly (and this may be more common now than not) the ebook uses all text, unlike some earlier versions of ebooks that used photographs of key text snippets as graphics which essentially renders them useless. Of course, copy and paste from a ebook is difficult, and that is where the zip file of scrips comes in. You can open the PDF file, get the zip archive, and as you read through examples simply open up (or copy and paste) the scripts from the zip archive and modify or run them. Also, the ebook is cheaper than a paper edition and clearly takes up way less space!

If I was going to recommend a starting out guide to shell scripting this is the book I'd recommend right now. It is well organized and well executed.
5.0 out of 5 stars The book is great for any new intermediate or advanced learner 15 May 2014
By Harpreet Singh - Published on
Format:Paperback|Verified Purchase
The book covers pretty much everything I was expecting to learn but I also learned many new things I was unfamiliar with,I like the way they write some script and then next part covers what each line of script is doing.I am still going through the book will update when I am done reading 100%
Were these reviews helpful?   Let us know
Search Customer Reviews
Only search this product's reviews

Customer Discussions

This product's forum
Discussion Replies Latest Post
No discussions yet

Ask questions, Share opinions, Gain insight
Start a new discussion
First post:
Prompts for sign-in

Search Customer Discussions
Search all Amazon discussions

Look for similar items by category