Don't neglect the shell - this book will empower you to use simple commands to perform complex tasks. Whether you're a casual or advanced Linux user, the cookbook approach makes it all so brilliantly accessible and, above all, useful. Overview 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 Approach 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.
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: Linux Shell Scripting Cookbook - Second Edition.
The book is precisely focused on shell scripting and is therefore allways 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 assingment, 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 comparisson 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.
The main challenge in learning Linux shell scripting is the "tyranny of choice". A standard Linux shell gives you access to hundreds of commands. Some commands are very popular and generally useful while some are quite esoteric. Learning all these commands would take a lot of time and is counter productive. So when learning the Linux shell, one is faced with the question of which commands to learn. Aside from the hundreds of commands, Linux commands, especially the most useful ones, have lots of options. Most of the time, one could be productive by learning only the commonly used options. So because of the large number of choices when learning the Linux shell, a linear approach of learning the commands and the options one by one would not be practical.
The Linux Shell Scripting Cookbook uses a problem-based approach instead of the answer-based approach. It starts with what you want to do and provides the solution. How to do it; which commands to run and the options that goes for each command. It also discusses variations of the solutions. Learning in this manner, in my opinion, is a perfect fit for learning the Linux shell. It eliminates the need to make choices on what commands and option to learn. You determine what you need to do, look at the solution and eventually build a set of commands and options based on your needs. Thus, making you productive right away. After learning a set of commands, you'll be able to better judge which commands are more useful to you and can pursue to master those commands. In my case, I realised that I would be more productive with a deeper understanding of sed and awk.
Aside from being a very good starting point to learn the Linux shell, the cookbook approach also serves as a very good reference. Had the book used the answer-based approach, content is organised by commands, you would have to figure out which commands would probably be applicable to your problem.
My favorite chapter in the book which I always keep coming back to is chapter 4, "Texting and Driving". Every now and then, I have to process data in text files and because the discussion of sed, awk, grep, and regular expressions in this chapter is concise and focuses on what is most useful, I could afford to do a quick read of the topics, before I start working. I noticed that the use-cases tackled are quite close to what I often need to do.
All things considered, I highly recommend this book to beginners and intermediate users of the Linux shell. However, I think the title of the book can be quite misleading. At first, I thought that the book was only useful to learn shell scripting, but it is also very useful as a Linux command reference.
I don't know why, but when I saw the title, I expected to be a book only about bash. Bash is a shell for *nix based systems and, as VIM, is one of the apps you can use for 10 years and, after reading something about it, you find something completely new.
Thing is, this is not just about bash. This book is about tools in the GNU system that can help write shell scripts. And even if you're pissed about Stallman asking to call the system GNU/Linux, this *is* about GNU tools: tr, expect, find... All GNU tools.
So "GNU Shell Scripting Cookbook" would be a more appropriate title.
About the content itself... It's mostly a miss than a hit. Some things are some wrong it hurts (Git does *not* add a `.git` directory inside every directory) and some are so utterly stupid to the point of being dangerous (you don't need root to chown a file!). Some points are so strange, they seem like the authors used a GNU/Linux for only two months and decided to write a book about it.
The book have two authors and it shows. Lots of repeated information, some things not building on things already said (really guys? Not matching pipe with stdin/stdout redirection?) will give you the impression that they never spoke about the book or had a roadmap for it. And there is a shitton of "as follows" (seriously, you'll get sick of reading "as follows" over the book). It says in the cover that, besides the two authors, there were at least 5 reviewers. But it seems none of them actually read the book -- and I'm not talking about easy things to find in a 1 minute Google search (like the git thing), but things like "this 'as follows' is getting through my nerves, you're using it every-fucking-where".
The content gets better in the end, when it gets over the "teaching phase", but you'll still have the bad taste of things wrong from the previous chapters.
So, basically, the book tries to cater to two different audiences -- the beginner and the master -- and doesn't seem to be able to provide a good content for any.
This is a good book for all the beginners to intermediate Linux power users and system administrators out there. Easy to read, being a cookbook it allows the reader to freely jump directly to the subjects of interest without having to pass through all the previous recipes. DevOps could also find this useful, mainly if they are interested in strengthening their Bash skills to ease cloud deployment.
As stated above, this is a cookbook, not an introductory text to convince the reader to leave Microsoft and embrace the penguin, nor to get him started, step by step, with his favorite distro. No, this is a cookbook, a collection of independent recipes for all those that already use Linux on a daily basis and want to get the most out of their Bash shell.
Linux Shell Scripting Cookbook is divided into 9 chapters, summing up 110 recipes, most of which are clever one liners that you want to take note of. The very end of the book, which covers topics that will probably interest more system administrators rather than home users, has, instead, complex scripts and focuses on networking, monitoring and logging.
I must admit that some command such as tr, sort and logrotate, commands that I reckon as must know, should have been given more space and examples. On the other hand, instead, others, such as ps, were given way too many pages.
Concluding, Linux Shell Scripting Cookbook is a good book. Not great, but good. Certainly a good companion for anyone interested in unleashing the power of the Bash shell.
As usual, you can find more reviews on my personal blog: http://books.lostinmalloc.com Feel free to pass by and share your thoughts!
The book is organized into 9 chapters which contain recipes to demonstrate real-life usages of shell scripts. It starts with basic Bash topics (simple commands like echo, environment variables, the prompt, redirection) in the first chapter. Then we have some more advanced commands like tr, cryptographic hashing commands and more in the second chapter. The third chapter deals with files and filesystems and handy scripts which are related: working with file permissions, printing the directory tree, finding and deleting duplicate files, and more. The other chapters deal with text utils, web scripts, networking, monitoring and logging, and administration tasks. The book contains over 110 practical recipes; in these recipes, the authors define a task and present a Bash script to achieve it. In many cases they expand on it (in sections titled "How it works..." or "There's more..."). I find this way of presentation very efficient and clear. In summary: the book is written well and easy to read, and is based on many practical, straight forward examples which can be used by many for daily tasks. One of its great advantages is it that it covers a wide range of topics. The book will be helpful for beginners and intermediate and is good to have near your desk.