Your computer’s Graphical User Interface (GUI) can’t do everything. There may be some more advanced features (such as those used by software engineers) that you can’t get to by just clicking around your desktop. Where the GUI fails, the Command Line Interface (CLI) succeeds.
As the name implies, the CLI works through commands typed out by the user. For example, if I wanted to see all the files in a certain folder (a.k.a. directory), I’d type:
On Mac or Linux, and:
Of course, listing the files in a directory is standard in your average How to use a computer for beginners guide, and isn’t really a good example of the CLI’s power.
If you wanted to display all files and folders in Finder on Mac (not possible through the GUI), you would type:
defaults write com.apple.Finder AppleShowAllFiles YES
This command isn’t nearly as strange and complex as it may seem. “defaults” is the software/app which we want to command, and everything else is an argument we pass to that command. Arguments are how you customize and change the behavior of a CLI app. For example, “/path/to/folder” in the above example is an argument that tells “ls”
to look in that specific folder.
From there on out, it can be inferred that “write” means change a file or preference, “com.apple.Finder” is the application which we want to change, “AppleShowAllFiles” is the specific preference we want to change, and “YES” is what we want to change that preference to.
How It All Connects
At its core, your computer’s OS is just a CLI. That CLI is running the software that makes up the GUI in the background, and by opening up a command prompt of some kind you’re creating a new instance of that CLI.
In Linux, UNIX, and macOS, a shell is the actual software powering the CLI, and it’s what interprets your commands and sends them to their proper places.
The most popular shell is the Bourne-Again Shell, or bash for short. It’s pre-installed as the default shell on most modern Linux distros and macOS versions. You can also choose to use the C shell, the Z shell, and many more.
Learning the Ways of the CLI
If you’d like to learn basic commands and usage of the Linux CLI and bash, you can check out a beginner’s guide here. But please note: the CLI is eons more powerful than your GUI, and since it’s aimed at more advanced users, has fewer restrictions on your ability.
For example, if you tried to delete system32 on Windows or the System folder on macOS, the file explorer would stop you dead in your tracks (and if it doesn’t, that’s somewhat concerning). On the other hand, the command line isn’t going to notice when you’re about to screw up and stop you (unless you’re running macOS 10.11 or greater).
In other words, with great power comes great responsibility. Don’t skim the article about basic shell commands and monkey around in the command prompt. Read and understand the article in full before actually experimenting with the console.