At Pantheon, we talk a lot about automating updates with testing and orchestrating multiple tools interacting to make a build system. For many folks, this might sound like some kind of mystic art. Literally the stuff of wizards and magic spells. But I am here to tell you, in all reality it is science. Computer science. And if you are willing to learn it, you can unlock abilities that do seem downright magical.
Underlying all of the amazing automation that Terminus and Quicksilver can give you is Bash, the command line interface for Linux, MacOS. I have met so many people who aren't sure where to start with Bash. They are scared to even try.
I decided to do something about it. I wrote a talk on the subject, called Bash is magic # no it's not. You can check it out in person at MidCamp 2019 and WordCamp Orange County 2019. To go along with this talk, I am also writing a series about the why, what, and how of this tool. Today, we are going to dig in to one of the most important steps for getting started, not being afraid of it.
Don't be scared
People are scared of what they don't understand, and the first encounter with a Bash terminal gives you absolutely no clues on what to do next, the way most Graphical User Interfaces (GUI) do. The tool itself seems to expect you to have a prerequisite level of knowledge of what to type at that weird looking prompt ending in a '$'.
I believe a large part of anyone’s fear is simply not wanting to mess up their computer. Going through the GUI menus and getting things set up 'just right' takes hours, maybe even many days of work. Stories abound of people deleting the wrong thing, making something unusable, or even exploding whole companies. While some of those stories are exaggerations, enough of these stories give us a false impression that doing command line stuff is better left to the "real" developers.
I am here to tell you what the majority of people who embraced Bash will tell you, "Just don't be afraid of it".
No one is born knowing this stuff. We all were beginners at one point. It is 100% okay to not know anything as you start learning. No matter where you are on the path of "Developer", there is never a bad time to learn new tools and it is never too late to dig in on any subject.
Later in the series, we will explore what Bash actually is and how to use it, but in the simplest terms, it moves and reads text files. Yep, plain ol’ text files. I realize that might sound surprising to a lot of people. Bash exists to create and manipulate files inside folders, something almost everyone does on a daily basis, without fear. The real secret of Bash’s power is that it can read the files, just like you can, and in some cases can do what that file says to do.
The benefits of Bash far outweigh the costs of learning this amazingly powerful tool. It will help you unleash the power of your machine and give you a valuable skill that is transportable beyond just Drupal or WordPress. It will let you speak a common language with every other developer on earth and let you do things that seem like magic.
Beyond the GUI
For me, why it’s so important to use the command line comes down to one thing, the freedom. The freedom to use my computer to do what I want. I do not just mean “Free as in Beer” or the "Free as in Freedom of Speech" the GPL enumerates. I mean free as in liberated from the constraints other developers have handed to me.
Developers work in a world where most users ‘just want to do a ‘thing’ with minimum effort or thought. So, many developers build a more or less intuitive GUI that lets the end user do just that. If a user wants to watch a movie, developers of video streaming services make that simple. If a user wants to navigate to and read an online article, there are browsers with lovely icons that explain themselves nicely. If a user wants to write a document, there are word processors that just let you open and start typing and then make it look like anything.
There is absolutely nothing wrong with using a GUI. I am not implying that. What I do believe to be true is that most users develop a worldview that their machines are fancy walled gardens. A view that their computers can only do x, y, or z and any new things require new GUI based tools. It makes users feel kind of powerless.
If you own a computer with at least as much power as an iPhone 5, you have over 130,000% more raw processing power than the entire Apollo space program. That power for most users is locked behind the decisions that developers have made for them.
The simple truth is your computer can do so much more than those predefined things in the GUI, all we have to do is tell it exactly what to do.
Unleashing the power everywhere
One of the most powerful truths of Bash is that it is everywhere. On almost every computer you will ever use. Even Microsoft has embraced it with the Windows Linux Subsystem. Once you learn just a handful of basic commands and concepts, you can begin to write scripts that can do almost anything and automate just about everything. And not just on your machine.
At Pantheon, we talk a lot about Continuous Integration services like CircleCI, GitLab CI/CD, and Jenkins. At the core of all of these services is Bash. In overly simple terms, a Continuous Integration service is just a computer somewhere running Bash scripts you wrote. Once you can see how conceptually straightforward Bash makes it is to connect a repository on Github to a service like CircleCI and push what it produces to a platform like Pantheon, all while doing rigorous testing along the way, then professional web development can become easier to do and with better results.
Next time, we will look at what bash actually is and how it works. I am looking forward to sharing this world of knowledge with you.
Remember, just don’t be afraid of it. The benefits far outweigh the costs of learning it.
You may also like:: Content, Development, Drupal, Testing & Optimization, Website Technology, WordPress