Wicked Cool Shell Scripts

wicked cool shell scripts 2ed
Credit: no starch press

Wicked Cool Shell Scripts: 101 Scripts for Linux, OS X, and Unix Systems by Dave Taylor and Brandon Perry, 2nd edition, no starch press (2017) is a book that can lift you up a notch in the super Unix techno-dweeb rankings. It's that good.

Not everything you encounter in your life as a Unix geek is going to rate being called “wicked cool”. Near as I can tell, this includes some of Tom's of Maine toothpaste along with some kids' toys, certain WordPress plugins, and the scripts in this book. The scripts are wicked cool because they can make you considerably better and more productive at using and managing your Linux systems.

Let me put this into perspective. I've been writing shell scripts on Unix systems since 1983 and haven't yet come close to having a set of even 25 scripts that are worthy of being dragged along with me from job to job, never mind 101 (actually 104 with the bonus scripts). Maybe you won't use all of these scripts, but you're likely to make use of many of them and dragging them from place to place is going to be dead easy.

Even if you're adept at writing your own scripts, you might not be this good. And getting a pile of scripts along with explanations of how each script works, what to expect when you use it, and possible tweaks that you might elect to implement is an incredible find.

So, let's take a quick look. First, the book covers fifteen fairly broad areas listed below. Each of these areas has between three and thirteen scripts, each with code, explanation, run information, and results.

Table of Contents
Chapter 1: The Missing Code Library
Chapter 2: Improving on User Commands
Chapter 3: Creating Utilities
Chapter 4: Tweaking Unix
Chapter 5: System Administration: Managing Users
Chapter 6: System Administration: System Maintenance
Chapter 7: Web and Internet Users
Chapter 8: Webmaster Hacks
Chapter 9: Web and Internet Administration
Chapter 10: Internet Server Administration
Chapter 11: OS X Scripts
Chapter 12: Shell Script Fun and Games
Chapter 13: Working with the Cloud
Chapter 14: ImageMagick and Working with Graphics Files
Chapter 15: Days and Dates 
Appendix A: Installing Bash on Windows 10
Appendix B: Bonus Scripts
Index

You can grab a full table of contents here.

Just thumbing through the book and examining the scripts is fun. The variety of scripts is surprising and the coding techniques that you can pick up quite amazing.

For example, you will find scripts to build a filenames database (all files on the system) and another to use the filenames database to locate a particular file. These can be very handy if you want to index your files weekly or overnight and save yourself a lot of time on a large server whenever you're looking for some particular file.

For another example, you'll get a script that will find suid files that are also group or world writable -- a serious security issue -- and be told if they've been modified in the last 7 (this setting is modifiable, of course) days.

$ sudo ./findsuid 2>/dev/null
**** /tmp/.sneaky (modified within 7 days and setuid root)

And that's just three scripts out of the 104. Tweaking your system, managing users, working with the cloud, dealing with dates, web mastering, creating useful utilities ... This book is a treasure trove of extremely useful scripts that you can use or modify and use to your heart's content. And you can download the scripts -- you don't have to hand type any of them -- from the no starch press site. Read more about the book -- available as a paperback or as an e-book here.

The first edition of this book was published in 2004. A lot of time has passed and much has happened since. This new edition covers a lot of important ground and is well worth that special spot you've on your bookshelf for the book that you need to be able to reach without standing up. This is one of those books you are likely to make very good use of in your Unix work life.

Whether you're a seasoned sysadmin or a rank beginner, you're likely to find a lot of scripts in this book that will save you some serious time and effort, teach you something, and allow you to show off your scripting and systems administration skills.

This article is published as part of the IDG Contributor Network. Want to Join?

To express your thoughts on Computerworld content, visit Computerworld's Facebook page, LinkedIn page and Twitter stream.
Windows 10 annoyances and solutions
Shop Tech Products at Amazon
Notice to our Readers
We're now using social media to take your comments and feedback. Learn more about this here.