Effective Shell

Investing just a few hours in your ability to use text based interfaces for your computer can have an enormous impact on your productivity. It can also make your work more fun, allowing you to maintain that creative 'flow' state that can make technology so exciting.

I've been lucky enough to spend many years working as a software engineer, but also with scientists, data engineers, site reliability engineers and technologists of all sorts. One thing that has stood out about great technologists has been their ability to make their tools work for them, stitching them together in creative ways that suits their style.

This is not a book on shell scripting or Linux administration! Each chapter in this book can be read as a standalone set of techniques to help you be more efficient, understand your system in more depth, and craft your environment to suit your working style. This book does not advocate that you totally change the way you work or drop your current tooling; it just brings together a set of skills that you can add to your toolkit and incorporate in your own way.

If you find this book useful, please consider donating to support my open source work.
Who Should Read This Book

Developers and engineers should find almost every chapter of this book immediately applicable in day-to-day work. Whether you use Python, Golang, .NET, Java, whether you use an IDE or the terminal, these skills will help in day-to-day work.

Site reliability engineers, system administrators and DevSecOps professionals will find these skills essential - if you regularly administer remote machines, connect to containers, manage clusters or cloud environments, you will find many techniques to help you with your work.

Hobbyists, polymaths and explorers should also read on - as well as going into specific techniques, each chapter gives essential knowledge on how these computers, operating systems and networking works.
What's In This Book?

Each chapter of this book aims to work as a stand-alone description of a set of techniques that you should be able to apply immediately. I have focused on keeping the information to the essentials that allow you to use the skill, rather than create an exhaustive description of every possible feature. This should allow you to pick up the book and read a chapter over a coffee and try out the skills straight away.

    Part 1 - Transitioning to the Shell is aimed at people who are new to the shell. You'll learn how to set up your environment, navigate your system, manage files, move between a desktop environment and the shell and how to get help. More advanced users may want to skip some of this content.
    Part 2 - Core Skills introduces the essential techniques that you should be able to apply immediately to improve your productivity. You'll learn how to use pipelines, rapidly move around the command-line and commands quickly, manage multiple tasks in parallel with jobs, the different types of commands that are available and how to search for files.
    Part 3 - Manipulating Text and Streams demonstrates many techniques to work with text -whether it's code, data or configuration. You'll learn how to use regular expressions, how to search through text, how to slice and dice text, how to manipulate code and data, and then how to apply these techniques to your shell commands themselves.
    Part 4 - Shell Scripting is a crash course in shell scripting. You'll learn how to write and run scripts, read and process input, perform logical operations, iterate over files and folders, build functions, handle errors and a set of re-usable patterns you can apply to your own scripts.
    Part 5 - Building Your Toolkit goes into the techniques you can use to create and customize your own environment. You'll learn how to configure the shell, customize your command prompt, manage your configuration files and share and manage your configuration with the Git version control system.
    Part 6 - Advanced Techniques introduces even more powerful tools and techniques, showing the fundamentals of each skill and how you might incorporate it into your work. You'll learn how shell expansion works, which is key to understanding many of the nuances of complex commands, when you should move away from shell scripts and into a full-blown programming language, how to build programs that integrate well into other tools in the shell, how to connect to other machines with the secure shell, how to use the popular terminal editor Vim and how to use terminal multiplexers. 

For the newcomer, you'll learn what a shell is, how to use it on your system, and then how to become more effective everyday by integrating the shell into your work. For the experienced professional, there is a wealth of detailed tips and tricks in each chapter that go into advanced topics and techniques to make you even more of a power user.
What You'll Need

If you are using a computer, you have enough to get started! In Chapter 1 - Setting Up Your Shell Environment you'll learn how to setup your shell in Windows, Linux or MacOS.

No Linux, shell or programming knowledge is required to use this book, all underlying concepts will be explained as we go along. Advanced users will be able to skip some of the explanations, but there is also enough depth in each chapter that users of all levels should be able to learn something new.
How To Read This Book

Commands that you can type into your shell, such as grep are shown as monospaced text. Paths to file and folders, such as the ~/effective-shell folder are shown in italics.

In larger code samples, the dollar sign is used to indicate where you would start typing - this is the command prompt. The text that you type is shown in **bold**:

$ echo "my shell is $SHELL"
my shell is /bin/bash

This book assumes that you are using a Bash-like shell, most of these shells should operate in a similar way. However, given the popularity of the Z shell (Zsh) are called out like so:
Z shell

Z shell specifics are highlighted like this.