When computers were first introduced, before Windows and before Mac was ever a thing, the command line (also referred to as console, command prompt or shell) was the primary way to interact with a computer.
Today, operating systems are way more advanced and have a well-developed graphical user interface (GUI). Most computer users are happy to use the mouse to click through menus and icons. Like in the below image showing a Windows 10 GUI (Graphical User Interface):
Still, the GUI doesn’t match the power and flexibility offered by a command line interface (CLI). This is why many developers and folks in the tech world prefer to use the command line.
And as you start your coding journey, the command line is one of the first things you should learn. Here is an intro to the command line for beginners, the importance of learning it, and the best resources to get you up and running with the command line.
What is the Command Line?
It’s POWER at your fingertips 🙂
The command line is a text based interface for controlling the computer directly (the “kernel” or central software at the heart of a computer).
Specifically, commands entered invoke kernel level commands. The command line can also be used as a scripting language to design your own utilities.
Below is what the command line looks like (I’m using the Bash shell running on Ubuntu Linux in the below screenshot)
Instead of using a mouse to double click or right click on files and folders, you simply type instructions onto a prompt and hit enter to execute them.
It’s like a window into the operating system. It allows developers to run text commands to navigate through the system, modify files, run programs, and even automate mundane tasks by running a batch of commands at once.
Who Should Learn The Command Line and Why?
First, the command line is a basic tool for system administrators and other IT professionals. They use it to program operating systems, run and maintain servers, and to automate routine maintenance tasks.
It’s also a fundamental skill for back-end developers. And many front-end developers use it too.
If you’re a project manager, product manager, a UX designer, or in any other line of work that requires you to work closely with software developers, learning at least some command line skills will make you a more valuable member of the team.
But the command line isn’t just for programmers and other computer professionals. It’s worth learning even for a regular computer user.
Knowing how to use the command line will allow you to unlock the power of your computer. You will be able to manage your system and accomplish some tasks much more efficiently.
Command Line vs. GUI: The Pros and Cons
A GUI simplifies computer navigation while a command line interface offers a powerful and flexible way to interact with computers.
As you learn to code, you will start to appreciate the power and flexibility the command line places at your fingertips.
Unlike a GUI, the command line can execute batch commands, which saves you time by automating tasks.
Running a simple command is also a convenient way to accomplish some tasks like checking your IP address.
Still, you might find yourself resorting to a mouse to click through menus and graphical icons when manipulating files and folders.
Popular Command Line Interfaces
There’s a wide range of command line interfaces or shells and the one you will be using will depend on whether you have a Linux, Mac OS, or Windows based computer. Here are the most popular shells:
Bash (Bourne-Again Shell)
Bash is the most popular shell for Linux/Mac operating systems.
This is because it’s one of the most powerful and user-friendly command line interfaces.
Furthermore, it boasts some convenient features that other shells don’t have.
The Command Prompt, aka the Windows Command Processor or CMD, is the default command line interface for Windows operating systems.
However, it is not very powerful, which is why most windows users use PowerShell.
PowerShell is an incredibly powerful command-line shell and scripting language for Windows. It simplifies configuration and allows automation of virtually any task on Windows systems.
It’s fairly intuitive, accepts and executes commands interactively and allows you to write scripts to manage Windows servers and online services like Office 365.
Recommended Command Line Resources for Beginners
Bash Scripting and Shell Programming Course
The Bash Scripting and Shell Programming course will have you writing bash shell scripts for Linux, Unix, & Mac OS X operating systems.
You will even learn advanced bash shell features you can use to write sophisticated scripts.
Clear presentation, and good examples and practice exercises make it easy to understand.
Best of all, what you will learn also applies to other shells including bourne (sh), KornShell (ksh), C shell (csh), Z shell (zsh), and tcsh shell.
Master Microsoft PowerShell Course
Master Microsoft PowerShell will give you a quick start on using PowerShell – all you will need is an afternoon. It’s easy to grasp and comes packed with concise illustrations.
You will learn PowerShell fundamentals and start writing functions and scripts that will save you time by organizing your hard drive and automating monotonous tasks.
Code Academy’s Learn the Command Line
More than 800k students have taken Code academy’s Learn the Command Line course.
It covers everything you will need to get up and running with the command line.
You will learn how to use the command line to navigate through files and directories, how to manipulate files, and how to configure the shell environment.
Best Books on The Command Line
The Linux Command Line, 2nd Edition: A Complete Introduction
The Linux Command Line offers one of the best introductions into the command line. It will take you from knowing absolutely nothing about the command line to executing some pretty sophisticated commands and even writing programs in Bash.
It covers everything from the basics of the Linux command line, navigating the file system, manipulating files and folders, pipelines to Bash shell scripting.
Though quite comprehensive, the book is still not overwhelming. An approachable and entertaining tone combined with practical examples make it a delightful read and easy to grasp.
Learn Windows PowerShell in a Month of Lunches 3rd Edition
As you can expect from the title, Learn Windows PowerShell in a Month of Lunches does an excellent job of breaking down Windows PowerShell into digestible chunks you can cover at lunchtime.
As a beginner, it will give you a solid foundation in PowerShell. Best of all, it doesn’t assume any prior knowledge of programming or scripting.
Written by veteran PowerShell MVPs Don Jones and Jeffery Hicks, even more experienced system admins will learn a lot about automating Windows tasks faster.
Learning the bash Shell: Unix Shell Programming (In a Nutshell (O’Reilly))
Learning the bash Shell is a top rated book for learning the bash shell. You will pick up the fundamentals of the bash shell quickly and the book also goes into more advanced concepts.
It starts with explaining what a command shell is, and goes on to cover the bash feature set, security, to more advanced lessons on scripting and shell programming.
The book is very well-written and organized for a beginner. It follows a gradual approach with small chunks, sufficient explanations, and practical examples.
Other Great Command Line Resources
Learn Enough Command Line to Be Dangerous is a fantastic introduction to the command line if you’re completely new to programming and don’t even know what a text editor is. The best thing about it is that it doesn’t assume any prior knowledge of programming.
Once you’ve installed Linux, LinuxCommand.org is the website to visit for step by step instructions on what to do next. You will learn what a shell is and how to use it to write shell scripts to get the computer to do your bidding.
A Command Line Crash Course is a quick way to get acquainted with the command line. First, it will show you how to locate the command line on your computer. You will then learn the commands you will be using to navigate through your computer.
Now that you’re getting into code, the command line will be an important part of your day to day operations.
It offers a faster and more powerful way to navigate around your computer. You might actually find that you prefer it to the GUI.
The command line for beginners resources we’ve recommended above are a great way to learn the commands you will be using and equip yourself with the knowledge that will help you unlock the power to be a rockstar developer.
Mike is the creator of Go With Code and a coder at heart 🙂