Intro to the CLI Concepts
Learning objective: By the end of this lesson, students will be able to compare and evaluate the advantages and disadvantages of GUIs (Graphical User Interfaces) and CLIs (Command Line Interfaces).
What is the CLI?
You’re already familiar with GUIs or Graphical User Interfaces. A GUI lets users interact with programs, files, and settings through visually-driven interactions. Because of its ease of use, the invention of the GUI ushered in the modern era of democratized computing. Before the GUI though, there was only the CLI or Command Line Interface. The CLI lets users interact with programs, files, and settings through text instead of graphical elements.
We interact with this interface by typing commands on the command line and then executing them. Everyday tasks you would accomplish from a GUI can also be performed in the CLI. For example, creating, modifying, and deleting files and directories, launching apps, changing application/system settings, and more. But if the GUI can accomplish many of the tasks that the CLI can with a slick interface, why does anyone still use the CLI? Why is it one of the first tools developers typically learn?
Why use the CLI?
The CLI is great for more advanced users like us because it has quite a few benefits:
- Power and speed - Once you’ve gotten over the learning curve of interacting with the CLI, it’s a much faster approach to doing basic tasks. It also allows you to accomplish what might be complex tasks in a GUI with a single command or a small series of commands instead.
- Repeatability - Commands can be saved, reused, and used by others. If you have an installfest, the commands you’ll run during it are an example of this. Commands can be bundled into scripts that accomplish a series of tasks. These scripts could be set to run automatically, or you could share them with others.
- Precision - Has an imprecise hand movement ever caused you to click the wrong icon in a GUI before? Clicks introduce chaos, and the CLI helps us tame that chaos. Commands can be written and edited before they are executed. Combined with the aspect of repeatability above, the CLI gives us a level of rigid precision that clicking in a GUI doesn’t provide.
- Tools - Some tools we use as developers only exist in the CLI.
The lecture setup you’ll conduct throughout this course is a great example of these benefits. Without the CLI, we would need different setup sections for macOS, Windows 10, Windows 11, and Ubuntu. Each section would need instructions and screenshots for completing setup steps using the GUI. Any screenshots would likely need to change as OS updates are released, and the GUI changes.
Instead of having this inconsistent and chaotic experience, we’ll conduct setup for lectures on the command line using the same pre-written commands regardless of the OS used. A huge win for us all! 🎉