Small, Sharp Software Tools
Harness the Combinatoric Power of Command-Line Tools and Utilities
by Brian P. Hogan
Version: P1.0 (May 2019)
Copyright 2019 The Pragmatic Programmers, LLC. This book is licensed to the individual who purchased it. We don't copy-protect it because that would limit your ability to use it for your own purposes. Please don't break this trustyou can use this across all of your devices but please do not share this copy with other members of your team, with friends, or via file sharing services. Thanks.
Many of the designations used by manufacturers and sellers to distinguish their products are claimed as trademarks. Where those designations appear in this book, and The Pragmatic Programmers, LLC was aware of a trademark claim, the designations have been printed in initial capital letters or in all capitals. The Pragmatic Starter Kit, The Pragmatic Programmer, Pragmatic Programming, Pragmatic Bookshelf and the linking g device are trademarks of The Pragmatic Programmers, LLC.
Every precaution was taken in the preparation of this book. However, the publisher assumes no responsibility for errors or omissions, or for damages that may result from the use of information (including program listings) contained herein.
About the Pragmatic Bookshelf
The Pragmatic Bookshelf is an agile publishing company. Were here because we want to improve the lives of developers. We do this by creating timely, practical titles, written by programmers for programmers.
Our Pragmatic courses, workshops, and other products can help you and your team create better software and have more fun. For more information, as well as the latest Pragmatic titles, please visit us at http://pragprog.com.
Our ebooks do not contain any Digital Restrictions Management, and have always been DRM-free. We pioneered the beta book concept, where you can purchase and read a book while its still being written, and provide feedback to the author to help make a better book for everyone. Free resources for all purchasers include source code downloads (if applicable), errata and discussion forums, all available on the book's home page at pragprog.com. Were here to make your life easier.
New Book Announcements
Want to keep up on our latest titles and announcements, and occasional special offers? Just create an account on pragprog.com (an email address and a password is all it takes) and select the checkbox to receive newsletters. You can also follow us on twitter as @pragprog.
About Ebook Formats
If you buy directly from pragprog.com, you get ebooks in all available formats for one price. You can synch your ebooks amongst all your devices (including iPhone/iPad, Android, laptops, etc.) via Dropbox. You get free updates for the life of the edition. And, of course, you can always come back and re-download your books when needed. Ebooks bought from the Amazon Kindle store are subject to Amazon's polices. Limitations in Amazon's file format may cause ebooks to display differently on different devices. For more information, please see our FAQ at pragprog.com/frequently-asked-questions/ebooks. To learn more about this book and access the free resources, go to https://pragprog.com/book/bhcldev, the book's homepage.
Thanks for your continued support,
Andy Hunt
The Pragmatic Programmers
The team that produced this book includes: Andy Hunt (Publisher) Janet Furlow (VP of Operations) Susan Conant (Managing Editor) Tammy Coron (Development Editor) L. Sakhi MacMillan (Copy Editor) Potomac Indexing, LLC (Indexing) Gilson Graphics (Layout)
For customer support, please contact .
For international rights, please contact .
Table of Contents
Copyright 2019, The Pragmatic Bookshelf.
Early Praise for Small, Sharp Software Tools
Small, Sharp Software Tools efficiently delivers the practical knowledge you should have if youre a developer who spends any time at all working at the command line. If youve been looking for a text that shows you how to get things done in a Linux or MacOS terminal without slogging through the esoteric things youll never use, this is the book you should read.
Trevor Bramble |
Senior Ruby Software Architect |
Brian Hogan is gifted at translating high-level command-line concepts into clear and easy to understand terms that anybody can quickly grasp. This book takes the reader on a journey through many of the most powerful command-line tools and utilities in a way that is easy to digest and enjoyable to read. The exercises are practical, useful, empowering, and fun to do. Theres something to be learned from this book whether youre brand new to the command line or have been using it for years.
Greg Myers |
Support Engineer, GitLab |
The tricks and tools described in this book will set any developer up to rock the CLI. I challenge anyone to not be more productive after learning these tools!
Dan Sarauer |
Computer Support Supervisor, City of Eau Claire |
Acknowledgments
Thank you, Susannah Pfalzer, for working with me on the initial version of this book. Weve worked on a lot of things together, and I still hear your editorial voice in my ear every time I write something.
Thank you, Tammy Coron, for editing this book and challenging me to think more deeply about my writing style and my approach. Youre great to work with, and I appreciate the effort you put in to keeping me organized and on track!
Thank you, Andy Hunt, for publishing this book. Weve talked about something like this for a long time, and Im glad were finally getting it done.
Thank you, Janet Furlow, for all you do to make every book we publish amazing. You do so much behind the scenes. I appreciate all you do.
Special thanks to Eric Wackwitz for being a sounding board as I developed and refined the curriculum which led to this book. And thanks to the hundreds of students who explored these exercises in class and in their homework. Your feedback was invaluable.
This book has a lot of content, and explaining it hasnt been easy. Bash is a tricky subject, and various versions of tools make it even more challenging. Im grateful to Trevor Bramble, Tim Chase, Andrew Herrington, Dan Kacenjar, Will Langford, Andy Lester, Sidharth Masaldaan, Greg Myers, Ryan Palo, Dan Sarauer, and Jessica Stodola for their time and feedback on this book. They caught a lot of mistakes and some poor explanations. I am incredibly grateful for their feedback.
Thank you to my business associates Mitch Bullard, Kevin Gisi, Alex Henry, Jeff Holland, Chris Johnson, Nick LaMuro, Erich Tesky, Myles Steinhauser, Josh Swan, Charley Stran, Mitchell Volk, Chris Warren, Mike Weber, and Andrew Vahey for your continued support.
Thank you, Ana and Lisa, for your love and inspiration.
Finally, thank you, Carissa, for your love and support, and for all you do for our family. I wouldnt be able to write books if it werent for you.
Copyright 2019, The Pragmatic Bookshelf.
Preface
The graphical user interface , or GUI, is designed for the average user and provides most of the necessary features needed for user interaction. Your smartphone doesnt have a user-accessible command-line interface, or CLI, because its aimed at the average consumer. You are only able to access basic features. But youre not an average consumer. Youre a programmer, a software developer crafting the best code from the finest bits. With command line, you can do everything you can do in the GUI, and morethat is, if you know how.