Copyright
Copyright © 2024 Robert S. Muhlestein (rwxrob). All rights reserved.
The code portions of this book are dedicated to the public domain under the terms of the Creative Commons Zero (CC0 1.0 Universal) license (https://creativecommons.org/publicdomain/zero/1.0/). This means you are free to copy, modify, distribute the code portions only, even for commercial purposes, without asking permission, and without saying where you got them. This is so there is no fear your creations are your own after learning to code using them.
The non-code prose and images are licensed under the more restrictive Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License (CC BY-NC-ND 4.0) (https://creativecommons.org/licenses/by-nc-nd/4.0/). This means that no non-code prose or image from the book may be reproduced, distributed, or transmitted in any form or by any means, without the prior written permission of the copyright holder. This includes remaking the same content in different formats such as PDF or EPUB since these fall under the definition of derived works. This restriction is primarily in place to ensure outdated copies are not redistributed given the frequent updates expected.
"A Code Mage’s First Spell Book" and "Code-Mage assistant" (case insensitive) are legal trademarks of Robert S. Muhlestein but can be used freely to refer to this book without limitation. To avoid potential confusion, intentionally using this trademark to refer to other projects—free or proprietary—is prohibited.
Bookshelf
A Code Mage’s First Spell Book
Learn practical computer science and programming with Go as a first language
Terminal Velocity
Master the fastest human-computer interface
Bonzai Beauty
Compose completable command trees with the Go Bonzai command-line framework
Linux homelab init
Extend your code-mage magic with Linux and a Proxmox power tower
Autodidactic
Keys to success as a modern knowledge warrior
Programming with Purpose
Code for self-empowerment to save humanity
Dedication
To Doris, my wife,
To friends of rwxrob,
To Chloe, my faithful assistant,
And to the memories of Aaron Swartz and Kris Nova:
Thank you for your light, support, and inspiration.
This book would never have happened without you.
Preface
Why another Go book?
I’ve spend several hundred dollars on Go books, always wanting to find one I could just use and recommend to absolute beginners—who have not only never coded before—but didn’t know the word "code" could be used as a verb, the type of beginner who thinks "print" involves a printing press or things that run out of toner, those who have never heard the words "Linux" or "GitHub" before in their lives, who think a "terminal" is something to run through at the airport when they are late for a flight. "Go, do you mean like Okay Go, that band from 90s?" These wonderfully clueless people have absolutely zero tech background and never regretted it, until now. Now, for whatever reason, they want to learn to code and, you guessed it, they cannot find a single book out there written for them.
I’ve been a nerd and a geek my entire life and have the photos to prove it (look up the difference). It turns out, I also have a gift for linguistics that includes speaking fluent Russian, French, Creole and English but also translating techno-babble into comprehensive prose and conversation in order to help anyone to discover how to learn anything in their own way. Since starting SKILSTAK Coding Arts in 2013 and learning and teaching Go in 2014 (when TJ Hallowaychuk famously wrote Farewell to Node) I have noticed all Go books suffer from one or more of the following annoyances:
-
Incorrect or out of date material
-
Avoid real, practical applications
-
Shun the terminal, except to compile
-
Assume "some programming" already, usually C
-
Lack a free and supportive learning community
-
Take themselves too seriously to be memorable or fun
-
Ignore how to setup a personal development environment
-
Pick poor project ideas that are too big and easily forgotten
Most of these books have some sort of dependency on the Internet to get the accompanying code, but none have any kind of downloadable personal learning assistant app, like the one I developed in Go for this book: Code-Mage.
At the risk of sounding too negative, I’ll describe the straw that broke my back. I bought a $40 book to learn about generics that turned out to not cover generics at all—but even worse—contained an entire chapter claiming to teach generics that contained a vague proposition for generics that was never adopted by the language. This author and publisher rushed their book out based on false information confusing me and potentially thousands of others. Then they charged another $40 for a "new edition" of the same book without even attempting to give anyone back the money they wasted for the first book. I lost hundreds in premium time wasted. You can probably guess the book, author, and publisher, which is notorious for this kind of fraudulent cash-grab.
Needless to say, I was furious. Most books are written by great people who have put a lot of time and energy into them. At worse they are annoying in their imperfections. But this blatant "screw you, give us your money" made me mad enough to follow my own mantra: don’t get mad, get busy. I started thinking about what I would put into a book based on what I knew hundreds of absolutely non-technical people I had helped to learn Go as a first language would want, and now you are reading it.
Who should read this book
This book is written for anyone wanting to learn—or help someone learn—practical computer science and programming for real applications development. While we have fun with the whole fantasy magic theme, everything in this book is very real and might even get you a job someday. It is true that this book can be reliably used as a text book for absolute beginners with enough algebra to understand what a mathematical function is but this book very clearly includes everyone outside of educational institutions. In fact, I wrote it mostly with pro-active parents in mind who want to give their kids a head-start in tech that they simply cannot find in most traditional education systems, the same reason, in fact, that I started SKILSTAK Coding Arts in 2013 with my own retirement money.
What’s with the magic thing?
Yes, the magic stuff is absolutely silly—on purpose. Self-proclaimed "serious" people and pedagogues (not necessary one and the same) seem to find fault with what is a well-established scientific principle of memory: silliness. Human brains are hard-coded to remember silly narratives and images. This is how memory competitors memorize Pi to 100,000 digits, by creating a silly, colorful narrative in their brain that they replay related to each of the numbers as they walk through a "memory palace," a mental map of a familiar location where each story occupies a specific spot containing different sets of numbers. Coming up with your own silly stories to associate with coding skills is the best, but all this talk about magic and mages is a head-start. If it’s not your thing, there are plenty of other boring books covering nearly the same stuff to slog through (most of which are 10 years out of date).
What’s included in the book
This book is focused on learning to code in Go from the terminal command line and everything that requires for an absolute beginner who has never even heard of a terminal before, that’s it, nothing more. It is very rewarding creating command-line programs from the command-line itself. We want to get doing that as fast as possible, but some stuff cannot be skipped to get there. Anything that can, has been.
Book organization
This book is divided into four main parts:
-
Introduction: Understand what coding means
-
Prepare: Get everything ready and master coding prerequisites
-
Learn: Code memorable micro-projects based on concepts
-
Create: Develop something useful that you want
The Code-Mage (cm) command
I created Code-Mage to skip a lot of that setup stuff with cm init
in a way that you can come back to later and understand it if you want. But that’s not all it can do:
-
Dynamically display contextual help while you are typing
-
Validate your work and catch bugs as you progress
-
Create unit tests if you’d rather not type them in every time
-
Time how long it takes you to complete a challenge
-
Run a web-server for certain projects that require it
-
Display community news and announcements
-
Read this book in your web browser without Internet
I won’t lie, I’m very proud of Code-Mage. I really wish I had it when I was learning. In fact, making the things you wish you had is a great way to find project ideas and motivation. The source code for Code-Mage is entirely public domain and open for review so you can compile and install your own if you feel uncomfortable—as you should—trusting a downloadable executable from the Internet. More on that later (see Preparation).
How to use this book
This book is generally designed to be read linearly, from top to bottom. The concepts build on one another. However, each "spell" is designed to be re-learned often like a mage preparing for a specific adventure. Not all spells can be memorized and at the ready at all times, which is why you create your own code book containing spells of your own creation to go with this book.
Skip the Introduction if you are already really motivated and just want to get right to coding. You can come back to it later. Don’t skip the intro, however, if you are still wondering if coding is something you want to learn.
Here’s how you will master each concept and skill by applying the verbs of Bloom’s Taxonomy: remember, understand, apply, analyze, evaluate, create:
-
Remember a new skill or concept by its fantasy theme association
-
Understand the problem: Why is this skill or concept needed?
-
Understand the solution: How do I overcome the problem?
-
Implement first solution with help and guidance from mentor
-
Repeat same first solution several times starting over every time
-
Create new challenge: different variation of problem with new solution
-
Assess effectiveness and validity of new solution with help from mentor
-
Correct and refine solution as needed
-
Repeat step #4 until mastery
-
Interalize by mentoring another
Повторение — мать учения.
Repetition really is the mother of learning. While often we demonize "rote repetition" in the West, the slavs have promoted it for decades. The neurons in our brain store memory by having the same electical impulses repeated over and over. So in order to program oneself the only way is to repeat it. Repeat these spells as fast and as regularly as you can and you’ll end up training your own neural net just like a machine learning model—but in your head. Repetition can be great to supplement your growth while working on a bigger project—especially in the early days before everything becomes second nature.
Supplement your reading
This book is but a part of a more complete personal learning strategy. Make sure not to neglect the other parts:
Join a community
Humans are social creatures and learning is communal. Join a community that is focused on learning the same things as you. Meetups, hacker spaces, clubs, church groups, social media, and live streamer chat groups are all great places to find a community. The community is a place to collaborate and share peer reviews of one another’s learning and projects.
My sincere hope is that the parents, teachers, and mages reading these words will find opportunities and motivation to create their own coding clubs and communities dedicated to helping others master the art of code and computer science and reap all the well-earned benefits of doing so.
While you are working on creating your own community, consider joining mine at https://linktr.ee/rwxrob.
Find a mentor
Humans have been passing knowledge one to another since the beginning. It’s what we do. Luckily learning happens naturally when someone with experience and knowledge is available to someone who knows how to ask questions, apply what they learn, and return with more questions. That’s you, the inquisitive one. The mentor’s job is to answer questions and provide feedback—not to "teach" you.
Most mentors won’t have that kind of free time available to constantly lead you by the hand on your learning journey. In fact, the more likely you are to hear from someone, the less likely you are to want to learn what they have to say. There are those who do stuff and those that talk about doing stuff. The more someone talks about doing stuff the less time they have to actually do something. It’s important to find people you know who are regularly and actively engaged in doing the thing you want to learn and then approach them about possibly mentoring you, perhaps for a small fee (most will decline).
You will find that many people want to share what they know but just don’t know how to do it or who would want to hear. Find these people and approach them. Perhaps you can find a few mentors so you can compare how they differ in their approach to programming.
Become a mentor
You don’t need any special training to be a mentor for someone else. In fact, as a beginner who has recently mastered something you are perhaps the best suited to help another beginner learn it because how you learned it is still fresh in your mind. Those with experience might be masters but often have difficulty remembering how they learned it and how to help others learn it as well. So don’t be shy by offering your help. And remember, you really haven’t learned it until you can succinctly help another learn it as well.
Consider AI assistance
In my experience ChatGPT is great for overall help with life, writing, and project organization—particularly from a phone over voice. Claude is better at code help and only has an API integration making it great for plugging into popular coding tools (like mods
from Charmbracelet).
Although I have nothing to do with any AI company, I do strongly believe in it as a learning platform and use it regularly to get answers and discuss topics 24 hours a day—even while riding my bike, code the boring stuff, and regularly practice my conversational and written Russian and French language. In fact, AI help with much of this book—especially the parts that must be validated to be sure they work (which I wish other coding books would do).
I highly recommend getting an AI learning assistant like ChatGPT as soon as possible. In my experience, such assistants are almost always better than than a random search of the Internet full of popular but incorrect answers to the same common questions that an assistant could better help with. My assistant is never tired of answering my questions even when my mentors or friends are.
On demand learning exponentially increases when an AI is involved. Nothing breaks through frustration and loneliness better when taking on learning challenges like a supportive AI companion even when a helpful human mentor is also available.
I believe we are quickly approaching a time when the digital divide will no longer be just between those who have computers and Internet access and those who do not, but between those who have learned to leverage a personal AI assistant loaded with contextual history and those who have not. We are already seeing this difference around us every day.
Introduction
Welcome to the magical world of coding! This book will help you learn programming concepts through memorable spells and cantrips which you can add to your own tome of coding magic, or code book, a digital notebook containing runnable code.
Why learn to code?
In a world increasingly shaped by technology, learning to code is no longer just the domain of software developers or computer scientists. It has become a valuable skill for anyone seeking to understand and influence the digital world around them. Whether you dream of building apps, automating tasks, solving complex problems, or simply gaining insight into how technology works, coding is the gateway to unlocking these opportunities.
Empower your creativity
Coding is a tool for creation. It allows you to bring your ideas to life, whether that means crafting a personal website, developing a game, or designing tools to solve everyday challenges. The ability to write code transforms you from a consumer of technology into a creator, enabling you to shape the digital experiences you wish to see in the world.
Solve real-world problems
From automating repetitive tasks to analyzing vast datasets, coding gives you the power to tackle problems efficiently. Whether in science, business, education, or personal projects, programming enables you to find innovative solutions and make a tangible impact.
Build a career in tech
The tech industry continues to grow at a rapid pace, with demand for skilled developers, engineers, and programmers far outpacing supply. Learning to code opens doors to a wide range of careers, from web development and mobile app design to artificial intelligence and cybersecurity. Even outside of traditional tech roles, coding skills are increasingly valued in fields like marketing, healthcare, and finance.
Enhance your critical thinking
Coding teaches you how to think logically and systematically. By breaking down problems into smaller, manageable components and constructing precise solutions, you develop skills that extend far beyond programming. These abilities enhance your decision-making and problem-solving skills in all areas of life.
Future-proof your skillset
As technology continues to evolve, the ability to code will remain a vital skill. Even as tools and platforms change, the foundational principles of coding endure, ensuring that your skills stay relevant in a dynamic world. Learning to code is an investment in your future adaptability and resilience.
Join a global community
Learning to code connects you with a vibrant and supportive global community of developers, learners, and innovators. From online forums and open-source projects to meetups and hackathons, coding provides opportunities to collaborate, share knowledge, and grow alongside others who share your passion.
Start your journey today
Learning to code is not just about mastering a skill—it’s about gaining the confidence to explore, experiment, and innovate in a world driven by technology. No matter your background or goals, coding has something to offer. The journey may have its challenges, but the rewards are immense. So take the first step—your adventure in coding awaits!
The life of a code mage
A Code Mage lives at the intersection of logic and creativity, wielding the power of code to conjure solutions, automate tasks, and build entire digital realms. Like any craftsperson of magic, their days are filled with discovery, problem-solving, and the relentless pursuit of mastery.
Morning rituals
The day begins with the Code Mage stepping into their sanctum—a workspace adorned with multiple monitors, glowing softly like enchanted portals, or perhaps just a single laptop and a cozy seat. A warm cup of coffee or tea in hand, they review their spellbook, often written in Go, Bash, Python, or JavaScript. They study the tasks ahead: debugging incantations, designing new algorithms, or collaborating with their guild (team) or aritficial assistant.
Practices of the day
The bulk of the day is spent weaving spells (writing code). Each line of code is a carefully crafted rune, combining syntax and logic to bring an idea to life. The Code Mage alternates between deep focus—when creating complex algorithms—and collaborative rituals like stand-ups or code reviews, where they share insights with fellow mages.
Their tools are many: - A Terminal of Power: Their command-line interface, where they summon commands to compile, build, and deploy. - Version Control Grimoire: Git, their repository of arcane knowledge, ensures their spells are versioned and shared. - An AI Consultant: A trusted companion for brainstorming, troubleshooting, and refining their spells, always ready with guidance and insights. - The Internet’s Tome of Knowledge: A vast resource for searching documentation, forums, and examples to expand their understanding and overcome challenges.
Encounters with challenges
Challenges are frequent. A spell might backfire, causing errors or bugs to emerge. The Code Mage approaches these with patience and logic, unraveling the mysteries of the code to banish errors and refine their craft.
Moments of triumph
The greatest satisfaction comes when a complex system runs flawlessly or when a particularly elusive bug is vanquished. Deploying a new feature to production feels like lighting a beacon for all to see—a moment of triumph for the Code Mage.
Lifelong learning
The Code Mage knows that mastery of the craft is an endless journey. They dedicate time to study grimoires (documentation), experiment with new languages and frameworks, and attend gatherings of mages (meetups, conferences, or online communities). Knowledge grows with each passing day, like adding new spells to their arsenal. Failure to keep up with their craft might see them blown up by one of their own incantations one day.
Evening reflections
As the day winds down, the Code Mage reflects on progress. They close their terminal with a sense of accomplishment, knowing they’ve pushed the boundaries of what’s possible. Sometimes, they ponder grander questions: how can their craft shape the future? How can they inspire new apprentices to take up the mantle of Code Mage?
A purpose beyond code
The Code Mage doesn’t just write programs—they solve problems, empower others, and build bridges between technology and humanity. Their magic isn’t limited to code but extends to creating tools, services, and experiences that make life better. The world becomes a better place all around because of them.
What it takes
Do not attempt to work through this book until you can type at least 30 words per minute from home row. This book makes extensive use of the terminal, which is fundamentally a typing-driven interface. |
Becoming a Code Mage is a journey that demands more than just technical knowledge—it requires a blend of curiosity, discipline, and creativity. To wield the power of code effectively, you must embrace both the challenges and the triumphs of the craft. Here are the key attributes and skills that define a successful Code Mage.
Curiosity and a thirst for knowledge
A Code Mage thrives on curiosity. They are driven to explore new tools, languages, and techniques. This thirst for knowledge leads them to delve into documentation, experiment with ideas, and uncover innovative solutions to complex problems. Curiosity keeps the journey exciting and ensures they remain adaptable in a rapidly evolving digital landscape.
Patience and perseverance
Coding can be frustrating at times. Bugs emerge, systems fail, and solutions may seem elusive. A true Code Mage approaches these challenges with patience and perseverance. They know that each failure is an opportunity to learn and grow, and they persist until the spell (code) works as intended.
Logical and analytical thinking
At its core, coding is about problem-solving. A Code Mage must be able to break down complex challenges into smaller, manageable components. Logical thinking helps them construct precise solutions, while analytical skills enable them to debug and refine their spells with accuracy.
Creativity and innovation
Coding is not just about logic—it’s also an art. A Code Mage uses creativity to craft elegant solutions, design user-friendly interfaces, and build systems that are both functional and beautiful. They are unafraid to experiment, taking risks to discover new ways to achieve their goals.
Attention to detail
The smallest mistake in code can lead to unintended consequences. A Code Mage hones their attention to detail, meticulously crafting each line of code and reviewing their work to ensure everything functions as intended. This precision sets apart a true master from an apprentice.
A love for learning
The world of programming is ever-changing. New languages, frameworks, and technologies emerge constantly. A Code Mage embraces lifelong learning, staying updated on the latest advancements and continuously expanding their arsenal of skills.
Collaboration and communication
While coding often requires focus and solitude, a Code Mage is also a team player. They collaborate with fellow mages (developers), share knowledge, and communicate effectively to build and maintain complex systems. They know that the strongest spells are often crafted together.
Resilience and adaptability
The digital realm is unpredictable. Systems crash, requirements change, and deadlines loom. A Code Mage remains resilient in the face of adversity, adapting quickly to new circumstances and finding creative ways to overcome obstacles.
Passion for the craft
Above all, a Code Mage possesses a genuine passion for coding. This passion fuels their dedication, making the long hours of learning and debugging worthwhile. It’s what transforms coding from a skill into a craft, and from a job into a calling.
Age and foundational skills
Becoming a Code Mage is a journey open to all ages. Whether you are a young apprentice or a seasoned adventurer, it is never too late to start learning to code. While age doesn’t matter, having a grasp of basic algebra can be incredibly helpful. Concepts like variables, equations, and logic are foundational in coding, and those with a background in algebra often find it easier to pick up programming concepts.
Are you ready to begin?
Becoming a Code Mage is not about perfection; it’s about embracing the journey. If you’re ready to cultivate these attributes and immerse yourself in the magical world of code, you already have what it takes to start. The path ahead may be challenging, but the rewards are boundless. The realm of coding awaits—will you answer the call?
Why Go as a first language?
If you have never coded, just know Go is the best first language to learn for those who want a balanced introduction to programming and computer science while also learning a very real and marketable modern language.
Go is the Goldilocks of first languages
It is strictly typed enough to teach the importance of data types but loose enough to keep the syntax simple yet powerful. Go is also easily the least verbose and most understandable of all the strictly typed, statically linked modern languages.
Go solves real problems
Go was invented at Google to solve enterprise-scale problems facing one of the largest tech companies on the planet by innovators Rob Pike and Ken Thomson. These pioneers also contributed to the invention of UNIX, Unicode (think emojis), and C (in which all modern computer operating systems are written). It’s no surprise, then, that Go is the most significant enterprise language of the "cloud native" revolution. Practically every application of this modern movement has been written in Go, including Kubernetes, OpenShift, Docker, Podman, Consul, Nomad, Helm, Vault, and Terraform. You may not know those applications now, but you use them every day indirectly through the largest businesses in the world that critically depend on them.
Hackers love Go
Want to dual-class as a hacker and Code Mage? Go’s got you covered. Go is the darling of cybersecurity professionals all over the world, for good or ill. In fact, it is so popular Rob Pike officially asked people to stop making malware with it. In 2021, the sharp increase in incidents of malware written in Go was documented by several news outlets and watchdog groups. Go’s 100% compatibility with C, cross-platform compilation, significant standard library, embedded filesystem, decompilation challenges, and static linking make it perfect for hackers as well as engineers who just want to build a solid multi-call monolith binary (like BusyBox). Just search for "hackers love Golang" to read more about it.
Go is great for terminal apps
Go’s sweet spot is for creating backend server APIs and terminal command-line tools, which is what this book is all about. After all, aren’t commands just spells we cast from the command line?
Prepare to code
Learning happens in the lab, not the lecture hall.
You are probably anxious to get coding, but first, you need to prepare your learning lab and master some prerequisite skills. For most people, this takes an hour or two.
Now is not the time to get distracted. Don’t bog yourself down trying to learn everything there is to know about bash, Linux, vim, tmux, and more. Wax on. Wax off. Focus on the fundamentals. The Karate will come later. So many people get caught up in endless hours online trying to find the absolute best possible terminal, colors and configuration. You could fight endlessly with people about the best editor, Linux distribution, first programming language, or color scheme. You could defend your decision to use your preferred operating system. Don’t! If you want to waste time "bike shedding" you personal development environment later you can—and who doesn’t love that—just not right now. You have a few very important things to do before you start learning to code. So get to it. |
Get a computer
Before embarking on your journey to craft Go-based command-line applications, you’ll need an enchanted workstation—a computer capable of compiling and running your creations. In this section, we’ll outline the minimum requirements for your workstation, compare the development experience on Mac and Windows, and help you choose the best option for your magical coding journey.
Minimum requirements
To create and compile Go-based command-line applications, ensure your workstation meets these minimum requirements:
Processor: A 64-bit processor (Intel or ARM).
Memory: At least 4 GB of RAM (8 GB or more is recommended for smoother multitasking).
Storage: At least 2 GB of free disk space for the Go compiler, dependencies, and your projects.
Network: Internet access for downloading the Go toolchain, dependencies, and updates.
Operating System:
-
Mac: macOS 10.13 or later.
-
Windows: Windows 10 or later.
-
Linux: Ubuntu-based (preferably Linux Mint, apt-based).
These requirements ensure that your workstation is equipped to create and compile the applications you create efficiently and handle the Go compiler, Alacritty terminal, bash shell, and Code-Mage assistant.
Rob Pike jokes that the Go language was conceived while they were waiting days for ungodly amounts of C++ code to compile at Google. The result is the most efficient language compiler on planet Earth. |
A laptop is ideal
A laptop offers unparalleled flexibility and convenience for coding, making it an excellent choice for learners. Here are some of its advantages:
Portability: A laptop allows you to code anywhere—whether at home, in a café, or at a library. This flexibility can help you maintain a consistent learning routine.
All-in-one design: Laptops combine essential components like a screen, keyboard, and trackpad into a single device, simplifying your setup and eliminating the need for additional peripherals.
Battery-powered: Laptops can run on battery power, allowing you to continue learning even during power outages or when you don’t have immediate access to an outlet.
Cross-platform testing: Many laptops can dual-boot or run virtual machines, enabling you to test your code across different operating systems (Mac and Windows).
Cost-effective for beginners: Entry-level laptops that meet the minimum requirements are often more affordable than desktop setups, making them a practical choice for new coders.
Real-world preparation: Many professional developers use laptops for their day-to-day work. Learning to code on a laptop helps you familiarize yourself with the tools and workflows you’re likely to encounter in the industry.
Collaboration and mobility: A laptop is easy to take to coding meetups, workshops, or classes, where collaboration with peers can enhance your learning experience.
While desktops offer raw power and larger screens, the mobility and convenience of a laptop often make it the preferred choice for learners and professionals alike.
Compare operating systems
When it comes to development, the choice between Mac, Windows, and Linux often depends on preference, cost, what’s already available, what is allowed at work, or compatibility with development tools. The choice of this main component of a personal development environment is a very personal one, make your own decision and don’t let anyone shame you for making it. Here are some considerations:
Mac (macOS)
Mac is generally preferred among developers including the author and Rob Pike himself who use a "Unix system with a custom desktop manager" (a fun way to troll people asking "what distro is that?")
Stop asking people "what distro is that?" It implies you think that anything with a terminal interface is a Linux system, which is just stupid. People who ask that obviously do not know what Unix is, the original inspiration of Linux powering 10s of thousands of enterprise computers on which our world depends. Also, don’t ever put someone else down for their choice of operating system, ever. We don’t care if have a neck beard and "use Arch, btw." It does not make you superior, just annoying and unemployable. One of the very few times I ever had to ban a member of my SKILSTAK learning community was for repeatedly demeaning people in our chat room who were learning to code on Microsoft Windows machines because it was all they had. That stuff makes me angry. Here’s a hot take: Windows desktop environment for anything involving the GPU for 3d acceleration is actually more stable than any Linux Desktop I have ever used, and I’ve used them all, extensively. |
Native Unix-like environment: Mac provides a Unix-based operating system out of the box, which is closer to the environments where Go originated. Unix predates Linux by a decade and Mac is officially the largest UNIX distribution on the planet. This means you can use tools like bash
and vim
without additional configuration, creating a seamless experience for Go developers.
Cross-platform consistency: The Go toolchain and libraries often behave more consistently on Unix-like systems (like Mac). This consistency can save you from troubleshooting environment-specific issues that sometimes occur on Windows.
Performance: Macs (especially those with Apple Silicon processors) are optimized for performance and energy efficiency, making them an excellent choice for compiling and running Go applications. Plus they need very little power allowing you to take your magic on the road.
Brew: The "missing" package manager (brew
) simplifies installing tools like Go, enhancing the development experience.
Windows
On the other hand, Windows offers its own strengths:
Familiarity: For developers transitioning from a non-Unix background, Windows might feel more familiar and comfortable.
Git Bash: Installing Git Bash provides a Unix-like shell environment, bridging the gap between Windows and Unix-based systems. This simplifies the use of tools like bash
and vim
without requiring additional configuration.
Winget: The Windows Package Manager (winget
) simplifies installing tools like Go, enhancing the development experience.
While both Mac and Windows can serve as capable workstations, Mac’s Unix-based environment, seamless toolchain integration, and developer-centric design make it the preferred choice for many Go developers. However, if you’re already comfortable with Windows or prefer its ecosystem, modern tools like Git Bash make it a viable option.
Linux
Some readers will have already installed Linux and just want to learn to code, or learn to code in Go. Linux is great, but honestly, it is very unlikely the absolute beginner for whom this book was written will have it because it has to be installed either on bare metal, into a container, or within a virtual machine. Doing all three of these things is definitely worth learning, eventually, just not now.
Besides, most schools wouldn’t even know how to install Linux in their labs even if they wanted to, and if they did, would have a lot more work to keep their Linux lab up and running. Some do, and they are amazing, but most are content to just use the most common proprietary desktop OSes.
For most of the 10 years I ran SKILSTAK in person I required people start with a cheap laptop on which they would install Linux themselves from a USB thumb drive that they downloaded and created. While it is not within the scope of this book, if you are up to the challenge this is a fun project with a lot of value later. I cover this sort of thing in one of my other titles: Linux homelab init. |
Choose the workstation that suits your needs best and ensure it meets the minimum requirements—your enchanted coding journey awaits!
Learn to launch anything
Every operating system offers a quick and efficient way to launch applications, open files, and search for information—similar to macOS’s powerful Spotlight feature. Learning how to use these tools effectively can save time and streamline your workflow. This guide will walk you through Spotlight equivalents on Windows, Linux, and other systems.
Why learn launcher?
Efficiency: Launching apps and files directly saves time compared to navigating menus. Your fingers never need to leave home row on the keyboard.
Focus:Search and launch tools help you avoid distractions by providing a single interface for tasks.
Universal Skills: Mastering these tools makes you productive on any operating system.
Spotlight on Mac
On macOS, Spotlight is the built-in search and launcher tool.
How to access Spotlight:
-
Use the keyboard shortcut
Command (⌘) + Space
. -
Click the magnifying glass icon in the top-right corner of the menu bar.
What you can do:
-
Launch apps: Type the app name and press
Enter
. -
Search files: Enter the file name or keywords.
-
Perform calculations: Type
5 * 7
or100 USD to EUR
. -
Look up definitions: Type a word to get a dictionary entry.
-
Search the web: Type your query and select a browser result.
Search on Windows
Windows provides a built-in search tool that acts as a launcher.
How to access Windows search:
-
Press
Win
or click the search icon on the taskbar.
What you can do:
-
Launch apps: Type the app name and press
Enter
. -
Search files: Enter the file name or content keywords.
-
Execute commands: Run shell commands directly.
Activities on Linux
Linux has multiple application launchers, depending on your desktop environment and preferences.
GNOME: activities overview:
-
Press the
Super
key (Windows key) to open the Activities Overview. -
Type the app name or file you want to open.
KDE Plasma: KRunner:
-
Press
Alt + Space
to open KRunner.
What you can do:
-
Launch apps: Type the name and press
Enter
. -
Open files: Search for files by name.
-
Run commands: Execute terminal commands directly.
-
Perform calculations and translations with plugins.
Learn Alt-Tab for window switching
The Alt + Tab
shortcut is a universal skill that works across operating systems, allowing you to switch between open windows quickly and efficiently. It’s one of the most basic yet powerful tools to enhance productivity. No additional graphical window manager (like i3
) is needed if you have already mastered this one skill.
Why learn Alt-Tab?
Speed: Quickly toggle between tasks without touching the mouse.
Universality: Works on nearly every major operating system, making it a portable skill.
Focus: Reduces distraction by helping you stay in the flow of your work.
Incorporating Alt + Tab
into your daily workflow ensures you can multitask efficiently across all platforms.
How to Use Alt-Tab
On Windows:
-
Hold
Alt
and pressTab
to cycle through open applications. -
Release both keys when the desired window is highlighted.
On macOS:
-
Use
Command (⌘) + Tab
for similar functionality. -
Press
Command (⌘) + ~
to switch between windows of the same application.
On Linux:
-
Most desktop environments support
Alt + Tab
natively. -
Additional variations, like
Super + Tab
, may be available depending on your configuration.
Others:
This functionality is supported on all tablets and phones as well so long as you attach a keyboard to them.
Create an email account
In the digital age, your email account is more than just a communication tool—it’s the foundation of your online identity. A reliable email address is essential for accessing educational platforms, joining communities, and managing services like GitHub. Here’s why getting your own personal email account is a critical first step in your journey (if you don’t have one already).
This section is unnecessarily long for most people. I have learned from direct experience with parents and educators that there is this idea that "students"—particularly kids—don’t need an email to learn. Strictly speaking they don’t, but there are very many reasons to get them started as early as possible with their own personal email that they carry it with them on their learning journey. Often schools setup an email only to rob them of it as soon as they leave school. This unnecessarily disrupts that learning history and new opportunities outside of that school (perhaps by nefarious design). |
Why email matters
Account Creation: Most services require an email address to create an account. Whether you’re signing up for GitHub to manage your code, joining an educational learning platform, or subscribing to a community forum, your email is the gateway to these opportunities.
Identity Verification: Services often use email for identity verification. This ensures that your accounts are secure and recoverable in case you forget a password or need to reset access.
Communication: Many platforms use email to send critical updates, notifications, and resources. A well-organized email account ensures you don’t miss important messages.
Privacy and Professionalism: A secure, reliable email address—especially one from a service like ProtonMail—protects your privacy and presents a professional image when engaging with communities and collaborators.
Choosing the right email service
For most users, selecting a reliable and secure email provider is vital. While free services like Gmail are popular, privacy-focused options like ProtonMail offer additional benefits, including end-to-end encryption, a free VPN, and strong data protection.
How email powers your learning and collaboration
GitHub: GitHub requires an email address to create an account and communicate updates about repositories, issues, and pull requests.
Educational platforms: Online learning platforms, such as Coursera, edX, and Khan Academy, use your email for registration and access to course materials. They also send reminders and announcements to keep you on track.
Community engagement: Developer forums, coding bootcamps, and discussion boards rely on email to verify users and facilitate networking.
Tips for managing email
Use a professional address: Choose an email address that reflects your identity and professionalism. Avoid overly casual or complex names. Restrict yourself to lowercase letters and only dots or dashes.
Did you know that Gmail provides unlimited aliases for any Gmail account by simply adding a plus to the name portion? (example+whatever@gmail.com) This can also be done by injecting a period anywhere in the name since they are ignored (e.xample, ex.ample, e.x.a.m.p.l.e, etc.). Using this technique allows a single email account to be used to create any number of different other service accounts and still have all of them use the common email account for communication and setup. The service thinks they are different users with unique email addresses even though the same Gmail account receives all the email to any of them. |
Enable security features: Use two-factor authentication (2FA) to protect your account and ensure your provider supports encryption.
Organize your inbox: Create folders or labels for services like GitHub, learning platforms, and community forums to keep your inbox tidy and manageable.
Setting up a reliable email account is a small but significant step that unlocks a world of opportunities in learning and collaboration. Whether you’re diving into development with GitHub, joining an online course, or participating in a vibrant learning community, your email is the first key to the digital kingdom. Choose wisely, stay organized, and let it be the foundation for your growth.
Create a Slack account
Slack is a powerful communication platform used by teams, communities, and organizations worldwide to collaborate and share ideas. Creating a Slack account allows you to connect with others, join workspaces, and participate in meaningful conversations. Here’s why you should create an account and how to do it.
Why create a Slack account?
Seamless Communication: Slack makes real-time communication easy with channels for focused discussions and direct messages for private conversations.
Community Engagement: Many livestream communities, open-source projects, and learning groups use Slack as their hub for collaboration and networking.
Team Collaboration: Slack is widely adopted in workplaces for organizing team communication, file sharing, and project management.
Integrated Tools: Slack integrates with tools like Google Drive, GitHub, Trello, and more, streamlining workflows and enhancing productivity.
Also see Why Slack over others?
How to create a Slack account
Visit Slack: Go to Slack’s homepage in your web browser.
Sign up: Click on the "Sign Up" button. Enter your email address and click "Continue."
Verify email: Slack will send a confirmation email to the address you provided. Open the email and click the verification link.
Set Up Your Profile: Add a profile picture and fill out your display name and other details. Customize your profile to reflect your personality or professional role.
Consider installing app: Slack can be used entirely from the web but also has a desktop application and a mobile phone app that can also be downloaded for better ease of use. Unfortunately, there is no decent command-line app (like IRC).
We have seriously thought of eventually creating a Code-Mage integration that allows looking up the latest messages in a specific workspace and channel and posting messages as well. Stay tuned. Or let us know if that is something you would like to eventually collaborate on. |
Join a workspace: There are any number of great workspaces to join, here are a few recommendations:
-
https://techworkersclub.com (minimal lifetime cost)
-
https://rwxrob.slack.com (free, but personal invite only, never anonymous)
Access to the https://rwxrob.slack.com workspace is invite only for my professional friends. I make no promises you will be accepted or not removed for any reason I see fit. Contact me to request membership and mention what you are interested in and why you want to become a member of our professional community. I am very peculiar about only allowing people dedicated to behaving professionally and helping anyone with their own learning journey. If you seek help, you promise to pass it on. There is no age restriction, but everyone in Slack is required to use their full, real name in their profile. No anonymous accounts will be accepted. |
Best practices
Explore Slack Basics: Familiarize yourself with channels, direct messages, and mentions.
Practice Professional Conduct: Unlike platforms such as Discord or Twitch, Slack is often used in professional environments. Using clear, respectful, and concise communication not only fosters collaboration but also helps build a reputation for professionalism. Avoid casual or overly informal language unless the workspace culture explicitly encourages it. Use proper grammar, avoid slang, and maintain a polite tone in all interactions. Slack is not Discord, Twitch, or Reddit. Be professional.
Why This Matters: Professional conduct on Slack mirrors workplace expectations. Practicing these behaviors now prepares you for real-world employment scenarios, where Slack or similar tools may be used daily. It shows potential employers and collaborators that you can engage respectfully and effectively in team settings.
Organize Your Workspaces: If you join multiple workspaces, switch between them easily from the sidebar.
Enable Notifications: Set up notifications to stay informed about important messages without being overwhelmed.
Customize Settings: Adjust your preferences for themes, availability, and message behavior.
Why Slack now?
Whether you’re connecting with our livestream community, collaborating with a team, or exploring learning opportunities, Slack provides a flexible and robust platform for communication and collaboration. By creating an account today, you gain access to an ecosystem of vibrant discussions, shared resources, and opportunities for growth.
Create a GitHub account
GitHub is one of the most powerful platforms for collaboration, code sharing, and version control. Creating a GitHub account is an essential step for developers, students, and anyone looking to participate in open-source projects or manage their personal projects effectively. Here’s a guide on how to create your account and why it matters.
Why create a GitHub account?
Version Control: GitHub is built on Git, a distributed version control system created by the inventor of Linux that helps you track changes in your code, collaborate with others, and maintain a history of your project.
Collaboration: GitHub enables teams and communities to work together on projects, sharing ideas, code, and feedback seamlessly.
Portfolio Building: Your GitHub profile showcases your work. It’s an excellent way to build a public portfolio for potential employers or collaborators to see your coding skills.
Access to Open-Source Projects: GitHub hosts millions of open-source repositories. Contributing to these projects helps you learn, network, and gain valuable experience.
Integration: Many tools, platforms, and educational resources integrate directly with GitHub, making it a central hub for your development activities.
See Why GitHub? for a more in-depth discussion and comparison to other services.
How to create a GitHub account
Visit GitHub: Go to GitHub’s web site in your web browser.
Sign up: Click on the "Sign up" button in the top-right corner and enter your email address, create a username, and set a strong password. Keep your username lowercase with nothing but letters and possibly a dash, avoid underscore.
Verify your email: GitHub will send a verification email to the address you provided. Open the email and click the verification link to activate your account.
Choose a plan: GitHub offers free and paid plans. For most beginners, the free plan is sufficient as it includes unlimited public and private repositories.
Set up your profile: - Add a profile picture and a bio that reflects your interests and goals. Optionally, link your website or social media accounts. Eventually, you will want to flesh out your special repo that matches your username that becomes your GitHub professional profile.
Create your first repository: A repository (or “repo”) is where your project files are stored. Click "New Repository" to start your first project. Name it notes
or codebook
and make it private, for now. Even though this isn’t really private stuff, it keeps from diluting your public appearance to others. Too many tiny projects and beginner repos distract from your online presence.
Follow some repos: Star and follow a few project repos. Consider starting with the following related to this book:
Who knows, perhaps soon you can contribute.
Why GitHub now?
Creating a GitHub account is not just a task; it’s an invitation to join a global community of developers. Whether you’re learning to code, managing personal projects, or contributing to the open-source world, GitHub provides the tools and visibility to grow your skills and connect with others. Start your journey today and become part of the development ecosystem.
Start taking notes
In the journey of learning, problem-solving, and creating, taking notes is as important as casting spells to preserve fleeting thoughts. Whether you use a sophisticated digital tool (like GitHub or Obsidian) or a simple piece of paper, the act of note-taking is a powerful practice that unlocks clarity, reinforces memory, and fosters creativity.
Why notes matter
Preserving ideas: Our minds are like flowing rivers of thought. Without notes, many brilliant ideas risk being swept away. Notes capture these ideas, making them tangible and retrievable.
Enhancing memory: The process of writing, even on paper, strengthens your ability to recall information. It’s an active engagement with the material that makes it stick.
Organizing complexity: Notes allow you to break down complex concepts into manageable pieces, creating a map that guides your understanding.
Encouraging reflection: By reviewing your notes, you can identify patterns, revisit insights, and refine your thinking over time.
The value of starting simple
You don’t need a perfect system to begin. Even a humble notebook can be your first spellbook. What matters is consistency and intent. Scribble ideas, sketch diagrams, or jot down questions—whatever helps you capture and organize your thoughts.
A note-taking habit for mages
Always be ready: Keep a notebook or a few blank sheets nearby, whether at your desk or on the go.
Write what matters: Focus on key points, insights, and actionable ideas rather than trying to transcribe everything.
Review and reflect: Set aside time to revisit your notes. What once seemed incomplete might spark new understanding.
From paper to systems
As your habit grows, you might find value in transitioning to a digital system that organizes your notes into searchable collections. But remember: the tool is less important than the practice. What matters most is capturing the magic of your thoughts, whether in ink or bytes.
Taking notes is not just about recording—it’s about thinking. With each word you write, you deepen your engagement with your learning, your ideas, and yourself. Start small, stay consistent, and watch as your notes become a treasure trove of inspiration and growth.
Start using Markdown
Your spell book will not just be written in Go, but also Markdown, a lightweight markup language that allows document formatting and such using nothing but a plain text editor. This page will guide you through the essential features of Markdown, helping you harness its potential for organizing and presenting information. Markdown is perfect for taking notes because of the following:
Simplicity: Markdown’s syntax is intuitive and easy to learn.
Portability: Notes in Markdown can be used across various platforms and converted to formats like HTML and PDF.
Focus: By removing the need for complex formatting tools, Markdown helps you concentrate on the content.
Versatility: Markdown works well for notes, documentation, blogs, and even presentations.
Basic Markdown syntax
The word syntax is a particularly important one. As a code mage you will see it a lot. It refers to the rules that govern the structure of statements or elements in a system. These rules determine how components (like words, symbols, or code) are arranged to create a valid expression or meaningful communication. |
The following covers only the Markdown syntax basics which are also covered for GitHub Flavored Markdown. You really don’t need all that right now and you should be careful not to make your notes incompatible with another Markdown tool later that you might want to use.
Simple really is better here. After having to port my knowledge base of notes between several different systems and always being burned by slight incompatibilities making a ton of work to do the conversion I have learned that sticking with the least amount of Markdown customization and extensions is best. When writing books, however, there are other alternatives that are far more powerful than Markdown, such as AsciiDoc, which is what this book is written in. |
Headings
Create headings by prefixing text with one to six hashtag #
symbols (but preferably no more than three):
# Header 1
## Header 2
### Header 3
Emphasis
Bold: Surround text with double asterisks (**
) or underscores (__
) (but preferably **
):
**bold text**
__bold text__
Italic: Surround text with single asterisks (*
) or underscores (_
) (but preferably *
):
*italic text*
_italic text_
Bold and Italic: Combine both for extra emphasis:
***bold and italic text***
Be careful about mixing the these within the same span. Markdown renders don’t really agree about how to handle that so error on the side of caution and avoid mixing them. |
Lists
Unordered Lists: Use -
, *
, or +
for bullet points (but preferably dash -
). Use four spaces for indented sub-list items:
- Item 1
- Item 2
- Sub-item 2.1
Ordered Lists: Use numbers followed by a period (just 1.
is fine):
1. First item
2. Second item
1. Sub-item 2.1
Links
Create clickable links with the format:
[Link Text](https://example.com)
Images
Embed images using the same syntax as links, but prefix with an exclamation mark (!
):
![Alt Text](https://example.com/image.png)
Code
Inline Code: Use backticks for short code snippets:
Here is some `inline code` in a sentence.
Block Code: Use triple backticks for multi-line code and the name of the syntax immediately after:
```go
func main() {
fmt.Println("Hello, Markdown!")
}
```
Blockquotes
Indent text with a >
to create blockquotes. Keep paragraphs to a single long line wrapper than wrapping the text so that the source code itself displays well on any window or tmux pane of any size. Hard wraps never work well:
> This is a blockquote. It can span multiple lines.
Separators
Also called "horizontal rule" using three or more dashes (----
), or tildes (~~~~
) (but preferably use exactly four to easily find them).
Tables
Create tables with pipes (|
) and dashes:
| Header 1 | Header 2 |
|----------|----------|
| Row 1 | Data |
| Row 2 | More |
Install PDE
Every great mage has their sanctum, a personal development environment (PDE) where spells are honed and wonders are crafted—a carefully constructed digital workspace where ideas come to life, lines of code flow seamlessly, and creativity flourishes. Crafting a PDE is not merely about tools and configurations; it’s an act of self-discovery and empowerment. A terminal-based PDE will seem daunting at first, like learning to play a fine instrument, but the power and music it produces later will resonant far better than any GUI alternative. Terminal interfaces aren’t just "for boomers" they are for a discrete, discerning set of technologists who operate on a magical plane much higher than most of their peers.
This section shows how to install all the components of your PDE with Code-Mage assistant—transforming your computer into a professional coder workstation with just one command—and then summarizes the components that were installed and configured for you so you can understand what happened. In fact, you can customize these later on your own. Everything that the Code-Mage assistant does is well explained in the Behind the Curtain section at the end of the book.
Download and install rwxrob-books
You must have permission to install software onto your computer, both policy-wise and the actual administrative permissions to your computer. If this is a work or school computer be sure you have that permission before installing or running anything. As to the security of |
Assuming you have don’t know what a package manager and have never heard of Linux before you can just go to the following URL, download the installer for your computer, and double-click it in your Downloads:
-
.msi
for Windows -
.pkg
for macOS (arm64
for newer macs) -
tar.gz
for Linux (you know what to do)
If you do have and know how to use a package manager, the following should also work:
-
Windows:
winget --id rwxrob.books -e
-
macOS:
brew install rwxrob-books
Those package manager steps can be repeated later to make sure you always have the latest.
Package manager: brew, winget
A reliable package manager is essential for managing dependencies, libraries, and tools effortlessly. On macOS, Homebrew (brew
) reigns supreme, while Linux users can rely on apt (for all Linux distros supported in this book). Even Windows has embraced the modern winget package manager. You will soon see in the next steps that these tools significantly simplify installing and maintaining the components of your PDE, ensuring everything stays up-to-date and compatible.
Shell: bash
Learning bash equips beginners with practical skills that directly translate to real-world tasks, providing a strong base for exploring more advanced tools and programming languages. The bash shell is the official Linux shell and a cornerstone of command-line environments. Most modern shell scripts are written in bash, which is actually safer than its POSIX shell predecessors when written correctly (double brackets instead of single, for example). Windows doesn’t come with bash so Git-Bash needs to be installed. Even though bash is preinstalled on Mac, it is very old and needs to be updated. All Linux systems come with the most recent bash so it need not be installed. Later, Code Mage assistant installs an initial ~/.bashrc
file that can be further customized later and saved to your "dot files" on GitHub.
Terminal: alacritty
You either get why the terminal user interface is superior or you don’t. No one is going to fight with you about it. You do you. Just know that if you aren’t willing to give the terminal a try then this book isn’t for you. Stop reading now. When you eventually realize just how powerful the terminal can be this book will still be here waiting for you. |
Speed matters when navigating your PDE. The default terminals that come on all operating systems are really pretty slow, some don’t even implement the entire ANSI escape sequence set making them much less fun to use. So a GPU-accelerated terminal like Alacritty offers blazing-fast rendering, smooth scrolling, and a modern interface. This ensures that your terminal keeps up with your pace, allowing for a more seamless and efficient workflow. Plus, this makes creating fun terminal animations and games all the more entertaining and—more importantly—memorable so you remember what coding skill or principle you learned while making it.
FunFact: The proper name for a terminal is actually terminal emulator since text terminals all originated from teletype machines. References to their origins still abound: terminals drivers are called |
Theme: gruvbox-material
Don’t underestimate the power of aesthetics. A visually pleasing color scheme, like Gruvbox or Solarized, can make hours of coding feel less like a grind and more like art. Color syntax highlighting makes short work of understanding a complex bit of code. Code Mage assistant will install this theme in the next steps.
I once found a critical error in a core configuration file managing all secure shell access to an enterprise computer. The mistake was trivial, but serious, had the person been using a color terminal instead of their beloved black and white putty they would have caught it instead of me. |
Editor: n/vi/m + plugins
Your editor is the heart of your PDE. There’s no beating the minimalist power of vi
(pronounced "vee-eye") the visual extension of ex
, a descendent of ed
the first official Unix text editor. Vim and Neovim are its descendants.
Vi is everywhere: Sure you could learn a GUI editor like VSCode (your friends certainly are) but vi is on just about everything by default and is preferred by discerning technologists who want to be good on any Unix-like system they encounter (rather than only their own bloated workstation). Even if you prefer a GUI editor later, say for web development (which makes sense), it is still best to learn vi first.
Vi navigation is in more than just editors: Lots of things that have nothing to do with editing text files depend on "vim bindings." This includes every Unix-like shell ever made (activated with set -o vi
).
Vim filters: The vim
filter commands (!!
,!}
, etc.) provide powerful shell integration that most other editors just can’t touch.
Some may wish to read Why no nano?
Now is a good time to mention the principle of progressive enhancement. You will likely hear about this again if you ever do any web development. The P in PWA stands for this principle which is that all applications should detect the minimum functionality available for use and progressively add on functionality as more advanced functionalities are detected. For example, a web app should work with just basic static web pages by default, but if JavaScript is detected it can upgrade itself and start using that. This way the most users are supported without unnecessarily blocking those that don’t have the higher functionality. It’s just good design. A solid example of this that relates to your shiny new PDE is the |
As great as Neovim is, it can get just as slow and bloated as graphical editors when people get carried away, which has become something of a meme. Therefore, keep your vim setup clean and light for now. |
Window manager: tmux
"What’s your window manager?" That’s a question people with way too much time on their hands will ask you. Soon you can answer "tmux!"
Strictly speaking tmux is a terminal session manager, a multiplexer (i.e. multiple screens, like a movie ciniplex) not a window manager according to most people’s definition, which is normally associated with a graphic user interface even though Ctrl-w
in tmux stands is for "terminal windows" so yeah, tmux is a window manager.
Tmux isn’t just for managing windows, it also provides universal cut and paste functionality without leaving the terminal (stuff you cannot do with just a terminal editor) or using your mouse and allows live collaboration with your buddies all sharing the same virtual keyboard. Most importantly, however, tmux provides a safe way to leave something running and reattach to it later, even if your connection is dropped or your terminal crashes. This is virtually impossible without tmux. Learn it.
I’ve worked more than 30 years as a remote employee, logging into central enterprise systems responsible for running things that keep products, money, and power flowing. What would happen if during an important, long-running thing my Internet connection died? That exact thing has happened multiple times, but every single time I was able to recover by simply reconnecting to my work network and reattaching tmux (or screen, tmux’s ancestor), sometimes while other team members were also connected simultaneously. People who say, "you don’t need tmux" are really limiting themselves at best, and living dangerously at worst. A terminal app could crash and you could lose all your work without it. |
Source control: git + gh
Source control systems like Git help manage the spellbooks of developers. They preserve your progress, allow experimentation without fear, and let you collaborate with others seamlessly. GitHub is the leading source control service and uniquely allows repos, pull requests, issues, comments to be managed with the gh
command line tool (written in Go, btw).
Research: w3m + mods + claude
Harnessing the power of command-line tools like the terminal web browser w3m
and the command line AI query tool mods
from Charmbracelet powered by the Claude API, creates a streamlined environment for efficient web browsing and AI-assisted research from the terminal that dominates those doing the alternative from graphic user interfaces. This setup ensures you stay focused, efficient, and immersed in the terminal-first environment.
Reference: man, help, cm
Unix manual pages can be pulled up with the man
command. The help
command contains everything about the bash
shell. And the Code-Mage cm
command is there to check your work and provide a local copy of this book anywhere, Internet or not.
Learn to code
Elements of code alchemy: the building blocks of all programs
Programs, like alchemical creations, are forged from a set of fundamental elements. These elements, when combined with skill and intent, create the intricate systems that power our world. Understanding these core components is the first step in transforming raw ideas into functional, elegant applications.
The four fundamental elements
-
Variables (Earth): The foundation of all programs, variables store the data that gives your code purpose. Like the solid ground beneath your feet, they provide stability and structure.
-
Logic (Fire): The spark that drives decision-making, logic fuels the flow of your programs. Conditionals and loops ignite the power to adapt and respond.
-
Functions (Water): The essence of reusability, functions flow through your code, modular and flexible. They bring order to chaos, transforming repetition into simplicity.
-
Data Structures (Air): The unseen currents that organize complexity, data structures enable efficient storage and retrieval. Arrays, lists, and maps carry your program’s breath of life.
Combining the elements
Just as an alchemist combines Earth, Fire, Water, and Air to create something extraordinary, so too does a programmer blend these elements into cohesive systems. Mastery comes not from knowing each individually but from understanding how they interact and balance one another.
Remember: every grand application begins with these elemental fundamentals. Master them, and you hold the key to crafting any program your imagination can conjure.
Cantrip: Echo Greeting (Hello World)
Problem: I need to print something to the console for the user to read.
Cast your first spell to greet the world of magic and code! This cantrip sets the tone for your magical journey ahead, giving acolytes like you a satisfying first success invoking code magic. "Hello World" is recognized across the realm as the first spell most mages will ever cast and continues to be a strong tradition today.
You should already feel completely comfortable opening, editing, and saving a file before doing this first spell. If not go back to Learn Vim until you have mastered the basics. |
package main (1)
import "fmt" (2)
func main() { (3)
fmt.Println("Hello, World!") (4)
}
1 | Declares this file is package main which is where the actio is |
2 | Imports the standard fmt package containing Println |
3 | Declares special main function, every program must have one |
4 | Prints "Hello, World!" to the console with a new line at the end |
I see sparks! Congratulations! If this is the first time you have ever written code that works then write this day down someplace special. Today is your coding birthday! One day you will look back on it with fondness and want to know what day it was that you started your life as a code mage.
Now delete it all and try again, from scratch. Maybe say something else. Then to it again until you can do it without looking before moving on.
Create applications
The path of the code mage: from learning to mastery
Many embark on the journey of learning to code through small, contrived examples—simple spells to grasp the fundamentals. But true magic lies beyond these first incantations, in crafting real-world applications that solve meaningful problems for real people. To transition from student to creator is to embrace the challenges of building tools, systems, and experiences that resonate with others and leave a lasting impact.
Behind the curtain
Welcome to "Behind the curtain," where we reveal the intricate mechanics powering the magic powering Code-Mage spells like cm init
and cm work
. This section is for the curious, the builders, and those who want to understand and take control of their tools. Here, you’ll learn how to set up everything manually, step by step. While this might seem like "the hard way," it’s also the most illuminating. It comes at the back of the book because really you shouldn’t worry about this stuff until you have at least gained some mastery of coding. Whether you’re here out of curiosity or necessity, this journey will deepen your understanding of the magic that makes it all possible.
These sections were once part of the main Prepare section of the book and have since been replaced with Install PDE. This is why they still read like they are positioned there in the book. I decided to preserve them here after |
Install the Go compiler
You’ll need the Go compiler to turn your code into runnable commands. Go is available for all operating systems via the package manager for each:
Mac:
brew install go
go version
Windows:
winget install --id GoLang.Go -e
go version
Linux:
sudo apt install golang
go version
These installs with the package manager should be getting a bit easier at this point, which is good because you’ll be doing this all the time as a code mage and tech professional. |
Install Code-Mage with go
Code-Mage is contained in the cm
command. See the summary in the Preface for more about what it does. Unlike everything most everything else we’ve installed so far, we are going to use the go
command itself to install the cm
command directly from compiled source. This is the best way to install any Go project. It is the safest since the entire code of the project can be read by anyone to ensure there has been no tampering (as opposed to downloading some executable off the Internet). Plus you always get the latest unless you specify another specific version. Not everyone will obviously have the go
command installed. Hence GitHub releases that contain binaries, and package managers like brew
, winget
, and apt
that vet binaries before making them available to everyone to install.
After opening a terminal enter the following command:
go install github.com/rwxrob/code-mage-book/cmd/cm@latest
This same command can be used any time to update to the latest version and works for installing any Go command as well. You will be doing it a lot to get the latest digital copy of this book and more.
Install bash
The bash shell (short for Bourne Again Shell) is a versatile command-line interface available on many operating systems. This guide explains how to install Git Bash on Windows, update bash to the latest version on Mac, and explains that bash is already included in most Linux distributions.
Install Git-Bash on Windows
Git Bash provides a bash emulation environment for Windows, allowing you to use Unix-like commands and workflows. (Read more about Why Git Bash? if you are wondering about WSL, virtual machines, and containers.)
Launch the built-in powershell
program as described earlier to get a command-line shell in order to install the new bash
shell. Then run the following command which installs bash (along with git and vim):
winget install --id Git.Git -e
This installs bash at "C:\Program Files\Git\bin\bash.exe"
which you can run from the Win
search box by typing bash
to test. Note that Code-Mage will update the Alacritty configuration later to use bash as the default for all new Alacritty terminal sessions.
Windows comes with PowerShell, but bash is definitely more user-friendly when it comes to command-line shell interactions. Consider one of the most powerful Unix commands ever invented: |
Update bash on macOS
Mac computers come with an outdated bash by default. You can update it using Homebrew but first we need to install it since it is not a built-in Apple product (even though it should be at this point).
Launch the terminal
program as described earlier and then run the following:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
Once brew is installed you can use it to update bash with the following command:
brew install bash
Unfortunately, Apple makes it hard to set this new bash shell as the default. Here’s how. Enter each of these commands one at a time:
echo "$(brew --prefix)/bin/bash" | sudo tee -a /etc/shells
chsh -s "$(brew --prefix)/bin/bash"
After you restart your terminal it should use the new bash shell which you can check with the following:
bash --version
FunFact: Homebrew is named after the meetup where Steve Jobs and Steve Wozniak met for the first time. |
Validate bash on Linux
Bash is pre-installed on most Linux distributions, as it is the default shell for many systems. All Linux distributions have a bash that is plenty new enough for everything we are going to do in this book. Here’s how you can check the version (after launching a terminal):
bash --version
Install Alacritty terminal
Alacritty is a modern, GPU-accelerated terminal emulator known for its speed and simplicity. It’s speed and support for millions of colors make it particularly good for creating performant terminal animations and games, which always make fun micro-projects when learning the coding fundamentals. This guide walks you through installing Alacritty on Mac, Windows, and Linux by downloading the official installers from the Alacritty GitHub repository.
Why install from the official site?
-
Security: Ensures you download the authentic, verified version of the software.
-
Stability: Access the latest stable release tested by the Alacritty developers.
-
Support: Get the correct files and instructions tailored to your system.
Step-by-step install
Mac:
-
Visit the Official Site:
-
Open your web browser and go to the Alacritty GitHub Releases page.
-
-
Download the Installer:
-
Locate the latest version of Alacritty.
-
Download the
Alacritty.dmg
file under the Assets section.
-
-
Install Alacritty:
-
Open the downloaded
.dmg
file. -
Drag the Alacritty icon into the Applications folder.
-
-
Launch Alacritty:
-
Open Spotlight (
Cmd + Space
), typealacritty
, and pressEnter
.
-
Windows:
-
Visit the Official Site:
-
Open your web browser and go to the Alacritty GitHub Releases page.
-
-
Download the Installer:
-
Find the latest release and download the
Alacritty-vX.X.X-installer.msi
file (replaceX.X.X
with the version number).
-
-
Run the Installer:
-
Locate the downloaded
.msi
file in your Downloads folder. -
Double-click the file and follow the on-screen instructions to install Alacritty.
-
-
Launch Alacritty:
-
Press
Win
, typealacritty
, and pressEnter
.
-
Linux:
If you managed to install Linux you probably already have a package manager and can just use that to install Alacritty instead. Open the built-in terminal and enter the following commands:
sudo apt update
sudo apt install alacritty
Only Linux distributions like Linux Mint, Ubuntu, and Debian that use |
Customize later
Don’t worry about customization for now. Running cm init
later will automatically configure the Alacritty teminal to startup up with a nice theme and font and reasonable defaults. You can always come back and update them in ~/.config/alacritty/alacritty.toml
file later.
Install GitHub CLI tool
Mac:
brew install gh
gh version
Windows:
The git
command was installed with Git Bash.
winget install --id Github.cli -e
gh version
Linux:
sudo apt install gh
gh version
Install git source control
Mac:
brew install git
git version
Windows:
The git
command was installed with Git Bash.
git version
Linux:
sudo apt install git
git version
Install tmux multiplexer
Mac:
brew install tmux
tmux -V
Windows:
TODO (Windows has no available tmux)
Linux:
sudo apt install tmux
tmux -V
Install Neovim (optional)
Vim is fine to get started coding, but Neovim, the modern spiritual descendent of Vim, is a cleaner experience at the cost of a little unnoticeable bloat. Notably, Neovim has a cleaner help interface and dynamic error displays. It is also far more extensible when such makes sense later—particularly for those use the same computer for most of their work. This guide walk you through installing Neovim on Mac, Windows, and Linux using the package manager.
Notice how similar these workflows are with modern package managers. All operating systems have finally caught up to using a package manager for software installation and management. Becoming proficient with them is therefore mandatory for any serious tech professional. |
Mac with brew:
Run the following commands one at a time:
brew install neovim
nvim --version
nvim
Later after you run cm init
(not yet) the vi
command will automatically detect nvim
and start that, otherwise it will run just vim
or the actual vi
.
Windows with winget:
Run the following commands one at a time:
winget install Neovim.Neovim
nvim --version
nvim
Linux with apt:
Run the following commands one at a time:
sudo apt update
sudo apt install -y neovim
nvim --version
nvim
Appendix: FAQ
This appendix is the final resting place of stuff that gets asked a lot, but does not really deserve a first-class discussion in the main context of the book. Most of these topics are distractions until a person has learned the other stuff.
What did cm init do?
The best way to know is to read the source code available at the following URL:
Here’s a summary of what running code-mage init
(or cm init
) does the following setup work for you so you don’t have to, for now:
-
Provide
cm
cheat sheet filling one screen with only essentials -
Set up your software installer (
brew
,winget
,apt
, etc.) -
Install the best terminal for your computer (usually Alacritty)
-
Configure terminal to use gruvbox-material colors and bash shell
-
Install latest bash shell
-
Provide
cm learn shell
interactive guide -
Configure bash with common preferences
-
Install
vim
or neovim (nvim
) depending on your computer -
Configure
n/vim
for coding Go, bash, Python, HTML, CSS, Javascript -
Provide
cm learn vim
interactive guide -
Install tmux terminal multiplexer to super-charge your terminal
-
Configure tmux to be vim friendly
-
Provide
cm learn tmux
interactive guide -
Install
git
distributed version control system -
Configure
git
for easy use as a beginner -
Provide
cm learn git
for learning basic git commands -
Install
gh
GitHub command line tool -
Provide
cm learn gh
for learning basic gh and GitHub -
Provide
cm save
that commit, comments, and pushes current repo to GitHub
Why Vim?
The benefits of Vim over other editors lie in its unique approach to efficiency, customization, and versatility. Here’s a breakdown of why many developers swear by Vim:
Speed and Efficiency
-
Modal Editing: Vim’s modal nature separates editing, navigating, and selecting text into distinct modes. This allows for precise and fast text manipulation without needing to move your hands away from the keyboard.
-
Keyboard-Driven Workflow: Everything in Vim can be done without a mouse, significantly speeding up tasks for those accustomed to its commands.
-
Commands as Composable Primitives: Vim commands can be combined in intuitive ways (e.g., daw deletes a word, yap yanks a paragraph). This composability makes it exceptionally powerful for editing text.
Lightweight and Ubiquitous
-
Low Resource Usage: Vim is highly efficient, making it an excellent choice for older machines or resource-constrained environments.
-
Available Everywhere: Vim comes pre-installed on almost all Unix-like systems, ensuring it’s accessible in nearly any server or terminal environment.
Customization and Extensibility
-
Highly Configurable: Vim’s configuration through .vimrc (or init.lua for Neovim) allows users to create tailored environments for specific workflows.
-
Plugin Ecosystem: Thousands of plugins extend Vim’s functionality, from language servers (LSP) for autocompletion and linting to themes like Gruvbox-Material for aesthetic improvements.
-
Scriptable: Vimscript or Lua (for Neovim) can be used to automate repetitive tasks or create custom commands.
Precision and Versatility
-
Powerful Search and Replace: Vim’s regex-based search and replace (:%s/pattern/replacement/g) works across entire files or custom ranges.
-
Macros: Record and replay sequences of commands, making repetitive edits easy and consistent.
-
Versatility: Suitable for quick edits or complex projects, Vim adapts to any programming or text editing need.
Productivity with Practice
-
Muscle Memory: Learning Vim takes effort, but once mastered, it becomes second nature, allowing you to edit text faster than with GUI-based editors.
-
Fewer Context Switches: Vim can be embedded into many tools (e.g., Git, terminal multipliers like tmux), reducing the need to leave your environment.
Longevity and Community
-
Long History: Vim has been around for decades, and its continued evolution ensures it remains relevant.
-
Active Community: An engaged user base and contributors produce a steady stream of tutorials, plugins, and updates.
Comparison with Other Editors
-
Vim vs. GUI Editors (e.g., VSCode, Sublime Text):
-
Vim is faster for text manipulation and navigation once learned but lacks a GUI’s visual aids.
-
GUI editors often have built-in integrations, while Vim relies on plugins for similar features.
-
Vim vs. IDEs (e.g., IntelliJ, Eclipse):
-
IDEs provide extensive language-specific tooling out of the box but can feel bloated compared to Vim’s minimalist approach.
-
Vim’s plugin ecosystem bridges the gap for features like autocompletion and linting.
In summary, Vim shines for users who prioritize speed, flexibility, and control over out-of-the-box features or visual interfaces. It excels in environments where efficiency and keyboard-driven workflows are paramount. While it has a steeper learning curve than other editors, the productivity payoff makes it a beloved tool for developers, sysadmins, and writers alike.
Why ~/.vimrc?
Using .vimrc as your main configuration file has several advantages for someone who values portability and needs to use Vim across different systems, especially when Neovim might not always be available:
Portability and Ubiquity
Vim is Ubiquitous:
-
Vim is pre-installed on virtually all Unix-like systems, including Linux distributions and macOS. It’s also commonly found on remote servers and even embedded systems.
-
This ensures you can always access a familiar editing environment without needing to install anything extra.
.vimrc Compatibility:
-
The .vimrc file is recognized by all standard Vim installations. By sticking to .vimrc, you ensure your configurations work everywhere that Vim is available.
-
Neovim can also read
.vimrc
, either natively or by sourcing it, making it possible to share your configuration between Vim and Neovim.
Simplicity and Minimal Dependencies
Avoids Neovim-Specific Features:
-
Neovim introduces some features, such as Lua-based configuration, that are not compatible with standard Vim. While these can be powerful, they may lock you into using Neovim exclusively.
-
By using
.vimrc
, you focus on features and plugins that work universally, avoiding incompatibilities on systems where only Vim is available.
Quick Setup:
-
If you frequently work on different machines or servers, having a portable
.vimrc
file that you can quickly copy or source makes it easier to get up and running. -
You can even store your
.vimrc
in a version-controlled repository (like GitHub), allowing you to fetch it quickly on any machine.
Efficiency and Familiarity
Immediate Usability:
-
With
.vimrc
, your configurations and workflows are immediately usable on systems with Vim pre-installed. No need to install Neovim or additional dependencies. -
This is particularly useful in environments like remote servers, where you may not have the permissions or the time to install Neovim.
Standard Features:
-
Vim and .vimrc cover the majority of use cases for editing, scripting, and navigating text. For someone who values speed and universality over cutting-edge features, .vimrc is often enough.
Use Case Scenarios
-
Remote Work: If you SSH into servers or work on machines where you cannot control the software installed, Vim is more likely to be available, and your .vimrc will ensure a consistent editing environment.
-
Team Environments: Some workplaces or collaborative environments may standardize on Vim instead of Neovim, making .vimrc the more practical choice.
-
Emergency Situations: If you find yourself on a system without Neovim, being familiar with and having a .vimrc setup ensures you won’t lose productivity.
Best of Both Worlds
For users who still want to take advantage of Neovim when available:
-
Dual Configuration: Use
.vimrc
as your main file and configure Neovim to source it:
vim.cmd('source ~/.vimrc')
This way, you can enjoy Neovim’s advanced features when it’s installed while maintaining a universal configuration for Vim.
Conclusion
Using .vimrc
as your main configuration file provides the most flexibility and portability. It ensures you can work comfortably in almost any environment without needing to rely on Neovim-specific features. For someone who values a consistent workflow across systems, .vimrc
is the pragmatic choice.
Avoid AP Computer Science
As of the writing of this book, the AP Computer Science program from College Board remains fundamentally broken. The materials are more than dated and down-right wrong in some cases. Here are some specific examples:
-
Using Java (without calling it Java)
-
Teaching students that "array indexes start at 1" (and not zero)
-
Emphasizing single-class, OOP inheritance over composition
AP Computer Science has become so irrelevant that many colleges either do not give credit for AP Computer Science or strongly suggest that students take the fundamental CS college courses anyway because APCS does not properly prepare them.
Put your time to better use, by building a coding lab at home, or starting a coding club with friends building real projects using modern principles of software development.
Why GitHub?
The case for the most widely used development platform
When it comes to platforms for managing and collaborating on code, there are several contenders, including GitLab, SourceHut, and Bitbucket. However, GitHub remains the most widely used and influential platform for developers worldwide. Here’s why GitHub consistently outshines its competitors, even for those who might have reservations about its corporate backing by Microsoft.
The power of popularity
GitHub’s dominance in the market isn’t just a matter of numbers—it’s a testament to its value:
Largest Developer Community: With millions of active users and repositories, GitHub is the go-to platform for collaboration and discovery. The sheer size of its community means more opportunities for networking, learning, and contributing to meaningful projects.
Industry Standard: Most companies, open-source projects, and educational platforms use GitHub as their primary development hub. Knowledge of GitHub is often expected in job applications, making it a must-know platform for developers.
Superior visibility
Searchability: GitHub’s advanced search tools make it easy to find projects, issues, and contributions, helping you discover opportunities and solutions faster.
Project Showcase: A GitHub profile serves as a portfolio, showcasing your work to potential employers, collaborators, and contributors. Public repositories on GitHub are more likely to be discovered and gain traction compared to other platforms.
Integration with Ecosystems: GitHub integrates seamlessly with countless third-party tools and services, from CI/CD pipelines to deployment platforms.
Best-in-class command-line tool
GitHub’s command-line tool, gh
, offers unparalleled efficiency for developers who prefer working in the terminal:
Ease of Use: gh
simplifies common tasks like creating issues, managing pull requests, and cloning repositories—all without leaving the command line.
Efficiency in Workflow: GitHub’s CLI provides shortcuts for managing projects and repositories directly, saving time and effort.
Advanced Features: Interactive features like viewing pull request details or switching between branches are intuitive and developer-focused.
Comparing to GitLab, SourceHut, and others
GitLab: While GitLab offers powerful CI/CD features, its interface and community size don’t match GitHub’s. GitLab’s paid tiers are often necessary for features GitHub offers for free, like private repositories.
SourceHut: SourceHut appeals to minimalists but lacks the extensive features, integrations, and user base that GitHub provides.
Bitbucket: Popular for enterprise solutions, Bitbucket trails GitHub in open-source adoption and community engagement.
Addressing Microsoft ownership
For some, Microsoft’s acquisition of GitHub in 2018 raised concerns. Many don’t know that Microsoft saved GitHub from catastrophic bankruptcy. However, Microsoft has largely honored its commitment to maintaining GitHub’s independence and focus on supporting open-source development.
Investment in Features: Since the acquisition, GitHub has introduced numerous improvements, including GitHub Actions, Codespaces, and enhanced security features.
Open-Source Support: GitHub remains home to the world’s largest collection of open-source projects, demonstrating its dedication to fostering community-driven development.
Conclusion
While alternatives like GitLab and SourceHut have their merits, GitHub’s unparalleled visibility, expansive community, and best-in-class tools make it the platform of choice for developers worldwide. Even for those wary of Microsoft’s involvement, GitHub’s contributions to open-source development and its continued innovation make it an essential part of any developer’s toolkit. Choosing GitHub means joining the largest, most active network of developers and setting yourself up for success in the modern software development ecosystem.
Why Git Bash?
When working with command-line tools on Windows, developers often choose between Git Bash, Windows Subsystem for Linux (WSL), or a full virtual machine (VM). While each has its strengths, Git Bash is often the preferred choice for its simplicity, speed, and integration with Windows. Here’s why Git Bash stands out.
Lightweight and fast
Minimal Setup: Git Bash is easy to install and requires minimal configuration compared to WSL or a VM, which involve additional software and system configurations.
Low Resource Usage: Git Bash consumes very little CPU and memory, making it an ideal choice for quick tasks and lightweight scripting.
Instant Access: Launching Git Bash is near-instantaneous, whereas starting WSL or a VM often involves initialization overhead.
Seamless integration with Windows
Native Windows Compatibility: Git Bash integrates directly with the Windows file system, allowing easy access to files without additional configuration. Windows paths (e.g., C:\Users\
) are natively accessible, making it straightforward to work with local files unlike WSL which has an entirely different user home directory and plays with file permissions in crazy ways. A file created on Windows is not compatible with one created with WSL even though they are both visible. This is extremely confusing for beginners.
Git and SSH Ready: Git Bash comes preconfigured with Git and SSH, which are essential for developers working with repositories or remote servers. No need for separate installations or bridging tools.
“Git Bash Here” Context Menu: The right-click context menu integration allows users to open Git Bash in any folder directly, speeding up workflows that need bash but started from the Windows desktop.
Simple learning curve
Familiarity for Developers: Developers coming from Unix-like systems find Git Bash familiar, as it uses Bash syntax and tools. Unlike WSL or a VM, there’s no need to learn additional commands for managing Linux distributions.
No Dual Environments: With Git Bash, there’s no confusion about switching contexts between Windows and Linux environments, as is often the case with WSL or a VM. Plugging in a USB device, like a Yubikey works as expected (which absolutely does not work on WSL and is problematic with a VM).
Portability and maintenance
Standalone tool: Git Bash is self-contained and doesn’t rely on external services or subsystems, making it easier to manage and update.
Cross-Machine Usability: Its simplicity makes it easy to replicate on multiple machines without worrying about installing and syncing full Linux distributions or VM images.
VPN networking: When logging into a virtual private network, for work, for example, Git Bash does not need special port forwarding that WSL or VM would require that you might not even be able to do depending on the security policies of your IT department regarding workstations. Git Bash is fundamentally just another application running on Windows so its traffic (from ssh
say) always works.
Avoiding overhead of WSL and VMs
WSL Drawbacks: WSL requires additional storage and configuration, especially when managing multiple Linux distributions. Some tools in WSL may behave differently from their native Windows or Unix counterparts, leading to inconsistencies. Permissions are inconsistent and USB devices cannot even be used.
VM Drawbacks: VMs require significantly more system resources (CPU, memory, storage) and often have slower performance due to virtualization overhead. Setting up shared folders and networking between the host and the VM can be complex and time-consuming.
Best for most developer workflows
Git Bash strikes the perfect balance for most developers:
For Git and development tasks: Git Bash provides all the essential Unix tools and commands needed for managing repositories and scripting.
For quick access: Its simplicity and speed make it ideal for everyday tasks without the complexity of maintaining a full Linux environment.
Conclusion
While WSL and VMs have their place for specialized needs (e.g., running a full Linux development stack or testing cross-platform applications), Git Bash is often the superior choice for developers seeking a lightweight, fast, and integrated command-line experience on Windows. Its ease of use, seamless compatibility with Windows, and low overhead make it the go-to tool for efficient development workflows.
Why bash for beginners?
When learning to use the command line, choosing the right shell is crucial. While there are many shells available, such as Zsh, Fish, and PowerShell, bash (Bourne Again Shell) stands out as the best option for beginners. Here’s why:
Ubiquity and universality
Default shell on most systems: Bash is official shell of the Linux project and the default shell on the majority of Linux distributions. Zsh is only the default on macOS because Apple refuses to accept the terms of the license change on the bash project (even though they say it is because zsh is "superior"). Bash is widely available, making it the most accessible shell for learners across different platforms.
Cross-platform compatibility: Bash works on Linux, macOS, and Windows (via Git Bash or WSL), ensuring consistent usage regardless of your operating system.
Industry standard: Bash scripts are used in countless production environments, making knowledge of Bash a valuable skill in the job market. Modern bash is far more secure than the ancient POSIX shell scripts from the boomer UNIX era (use of [[ ]]
that does not allow expansion injection attacks is just one example).
Simplicity and beginner-friendliness
Straightforward syntax: Shell scripting is never really that easy, its just powerful. But bash’s syntax is relatively simple and easy to grasp for newcomers—especially when compared to monstrosities like PowerShell. Commands and scripting follow logical, minimalistic patterns that are less intimidating for beginners. In fact, every line a person types on the command-line is an ongoing, running, interactive program. Placing any of those same commands into a file and running it becomes a script. In that sense, using bash at all is itself "coding."
Rich documentation: Bash has an abundance of resources, including tutorials, man pages, and community support. Most command-line learning materials are written with Bash in mind, making it easier to find help.
No Overwhelming Features: Unlike Zsh or Fish, which come with extra features and plugins that can confuse new users, Bash focuses on core functionality, allowing learners to build a strong foundation. Most importantly, bash generally only uses a single ~/.bashrc
file rather than splitting them all out making it easy to configure and even easier to share that same configuration on any other system by simply copying a single file (which is what cm init
does).
Portability and practicality
Write once, run Anywhere: Bash scripts are portable and can be executed on almost any Unix-like system without modification—especially if the convenient (albeit slightly less safe and performant) #!/usr/bin/env bash
idiom is used (which is essentially required to get bash scripts to work on Homebrew macOS machines that put the latest bash binary in a strange place by default).
Widely Used in Scripting: Bash is the default scripting language for many tasks, such as automating workflows and managing servers. Learning Bash provides immediate practical applications in automation and system administration.
Learning Core Unix Tools: By using Bash, beginners gain experience with essential Unix tools (e.g., ls
, find
, grep
), which are foundational for more advanced shell scripting and programming.
Zsh and other shells: why not start there?
Zsh: Zsh offers many advanced features (e.g., plugins, themes, and auto-suggestions) that are appealing for experienced users. However, these extras can distract beginners from mastering core shell concepts. And no one ever writes a "zsh script" for anything because no one can count on zsh being on the system and writing POSIX shell scripts is less secure and more annoying.
Fish: Fish is user-friendly and visually appealing but is not POSIX-compliant, meaning scripts written in Fish are not portable across systems. It introduces unique syntax that can make transitioning to other shells or environments more difficult. More importantly, however, fish promotes terminal muscle memory that does not work when on another system without it, a common occurrence in todays cloud-native, containerized, virtualised world.
PowerShell: PowerShell is powerful and Windows-centric but diverges significantly from Unix-style shells, making it less relevant for those learning Linux or macOS environments.
Conclusion
For beginners, Bash is the ideal starting point. Its simplicity, availability, and practicality make it the best choice for learning the command line. By mastering Bash first, you’ll build a strong foundation in shell usage and scripting that will serve you well in any technical career.
Why Slack over others?
Why not Discord, IRC, Webex, or Microsoft Teams?
Choosing the right platform for communication and collaboration is critical for fostering effective teamwork and building communities. While alternatives like Discord, IRC, Webex, and Microsoft Teams each have their strengths, Slack remains the best choice for many use cases. Here’s why:
Superior design for team collaboration
Focused workspace structure: Slack’s channel-based organization makes it easy to create distinct spaces for specific projects, teams, or topics. Unlike Discord, which caters primarily to gaming and casual communities, Slack is optimized for professional and organizational communication.
Powerful search features: Slack’s robust search allows users to quickly find messages, files, and conversations, even across multiple channels. IRC lacks modern search functionality, and Microsoft Teams’ search can feel clunky in comparison.
Threaded conversations: Slack supports threaded discussions, keeping conversations organized and reducing channel clutter. Discord has a lesser version of this and IRC lack this functionality, leading to chaotic, hard-to-follow discussions in busy channels.
Integration and automation
Wide range of integrations: Slack connects seamlessly with tools like GitHub, Google Drive, Jira, Trello, and many more. While Teams also integrates with many Microsoft tools, it lacks the breadth of third-party app support that Slack provides.
Custom workflows: Slack’s Workflow Builder enables users to automate repetitive tasks, streamline processes, and create custom notifications. Webex and Discord lack comparable built-in tools for workflow automation.
Usability and Accessibility
Intuitive interface: Slack’s clean, modern interface is designed for productivity and ease of use. Discord’s interface is heavily gaming-oriented, which can be distracting for professional environments. IRC requires technical knowledge to set up and lacks user-friendly features.
Cross-platform consistency: Slack offers a seamless experience across devices, including desktop, mobile, and web applications. Teams and Webex can feel less consistent or polished across platforms.
Enhanced features for modern teams
Rich notifications - Slack provides customizable notifications, ensuring users receive only the most relevant updates. Discord’s notifications can feel overwhelming, especially in larger servers.
File sharing and collaboration: Slack makes it easy to upload, share, and comment on files within channels. IRC lacks modern file-sharing capabilities, and Webex’s file-sharing features are less intuitive.
Community building
Professional branding: Slack workspaces can be customized to reflect your organization’s identity, fostering a sense of belonging. Discord’s branding and gamer-centric features may not align with professional or educational communities.
Moderation tools: Slack includes detailed user permissions and moderation tools for managing channels and workspaces. IRC and Discord require third-party bots or scripts for comparable functionality.
Security and privacy
Enterprise-grade security: Slack prioritizes data encryption, compliance, and administrative controls, making it a trusted platform for businesses. Microsoft Teams offers comparable security features but ties users into the Microsoft ecosystem. Webex has strong security but lacks Slack’s modern usability and integrations.
User Privacy: Slack allows admins to set clear boundaries for data retention and access. Discord and IRC, while flexible, may not meet the privacy standards required for professional use.
The best of all worlds
Slack combines the accessibility and simplicity of modern communication tools with the powerful features required for professional collaboration. Unlike Discord or IRC, it’s designed with productivity and structure in mind. Compared to Webex or Teams, Slack offers superior integrations, a more intuitive interface, and better support for diverse workflows.
For teams, businesses, and communities that need a flexible, reliable, and feature-rich platform, Slack is the clear winner.
Why no nano?
The nano editor might be on all Linux systems but it really isn’t as good as basic vi for beginners.
When starting out with command-line text editors, many beginners gravitate toward nano because it appears simpler and more user-friendly. However, this simplicity comes at a cost. While vi (or its enhanced versions, vim and nvim) might have a steeper learning curve, they provide a much better foundation for mastering text editing in the long run. Here’s why nano isn’t the best choice and how it can even create bad habits.
Nano’s misleading simplicity
Over-reliance on control key shortcuts: Nano uses control key shortcuts (Ctrl
+ letter) for basic operations like saving, exiting, or searching. While these shortcuts seem straightforward, they often overlap with critical terminal functions like Ctrl+C
(interrupt) and Ctrl+S
(pause/lock terminal output), causing confusion when beginners accidentally lock their terminal or interrupt running processes.
Limited Editing Features: Nano lacks advanced features that even basic vi provides, such as:
-
Efficient navigation (jumping to the start of a line, word, or character)
-
Powerful search and replace
-
Undo/redo capabilities that are intuitive and robust
Encourages Dependency: Nano’s heavy reliance on displayed shortcuts can prevent users from internalizing commands, making them less adaptable to other tools.
Why basic vi is a better choice
Widely available:
-
Vi is included on virtually every Unix-like system, ensuring you can rely on it no matter where you work.
-
Mastering vi guarantees you’ll always have an editor available, even in minimal environments.
Learn once, apply everywhere:
-
The skills learned in vi translate to other powerful editors like vim or neovim, which are used by professionals worldwide.
-
Vi’s modal editing (switching between insert and command modes) teaches fundamental text-editing concepts applicable in advanced workflows.
-
Vi navigation is built-in to all shells (with
set -o vi
) and many other systems because of its ubiquity.
Encourages muscle memory:
By not relying on on-screen prompts, vi forces users to internalize commands quickly, building long-term proficiency and preserving terminal screen real-estate.
Conclusion
While nano’s simplicity might seem appealing at first, it ultimately hinders growth and can foster bad habits. Starting with vi, even at a basic level, sets a strong foundation for effective text editing. Vi’s ubiquity, efficiency, and transferable skills make it the better choice for beginners who want to build confidence and adaptability in the command line.
A Code Mage’s First Spell Book
Learn practical computer science and programming with Go as a first language
Terminal Velocity
Master the fastest human-computer interface
Bonzai Beauty
Compose completable command trees with the Go Bonzai command-line framework
Linux homelab init
Extend your code-mage magic with Linux and a Proxmox power tower
Autodidactic
Keys to success as a modern knowledge warrior
Programming with Purpose
Code for self-empowerment to save humanity