When you start using Linux, you will find that the system relies much more on the command line than other operating systems despite the presence of many desktop environments. Why is it?
There are many reasons why the command line is an essential part of the Linux ecosystem.
1. When Unix was developed, there was no GUI
Although Linux is not Unix, as it has no system code, its behavior is based on it, including its use of the command line. When Unix was developed at Bell Labs in the late 1960s and early 1970s, there was no graphical user interface.
Most people submitted their programs on punched cards, while a lucky few could interact with the system using a terminal, like the creators of Unix: Dennis Ritchie and Ken Thompson.
These terminals were either teleprinters or video terminals, which were just a screen and a keyboard. Both of these terminal types only supported text, not graphics.
Command-line interfaces were natural for this type of terminal. The use of text terminals was also a major reason why Unix developers preferred short command names, as they were faster to type.
Programmers have been the strongest advocates of Linux because it has many tools to do their job: interpreters, compilers, and debuggers. And all of these tools run from the command line.
Although you can call them all from a graphical IDE, this is just a front end to a command line somewhere.
3. The command line is fast
Many Linux users like to claim that the Linux command line is faster than using a GUI. Command line programs start faster than graphical programs because there is less overhead.
This is one of the reasons why when Linux first debuted on PCs, distros defaulted to the console environment. Less powerful PCs of the time often had trouble running X, at least with the small amounts of RAM that desktop systems were equipped with.
You can see how an i386 PC with 4MB of RAM from the early 90s struggles to load a simple X window manager, and that was a fair amount of RAM at the time:
4. The command line works everywhere, including on servers
One of the main reasons the command line has survived on Linux systems is that it works just about everywhere. If X doesn’t like your graphics card, a problem that was also more common on early Linux systems, you’ll find yourself dumped on the console. This means you can fall back on the command line when you need to.
For this reason, it is common to install Linux servers only with the command line interface. This allows more efficient use of the server. After all, there’s no need for a GUI if no one sees it anyway.
Many administrators prefer to connect remotely via SSH to manage their servers. This reduced overhead allows Linux servers to operate more efficiently than Windows servers.
5. Command line programs can be scripted
A big advantage of command line programs over graphical programs is that programmers can automate them.
If you work with graphical programs such as file managers, you will often encounter repetitive operations such as renaming files. If you have a lot of files, it can get cumbersome with a graphical file manager. The shell lets you use wildcards to generate a list of files.
If you wanted to copy all your text files to a directory, you would use this line:
cp *.txt /example
You can also use scripting languages for more complex tasks. For many years, the scripting language of choice was the shell. The advantage of the shell is that you can use the familiar programs you used on the command line in your scripts.
While scripting languages like Perl and Python use libraries, it is also possible to use standard Linux programs if a library does not exist.
Now you know why Linux uses the command line so much
If you were confused by the importance of the command line for Linux, now you know how important it is for many technical uses such as servers and development. It even puts the computer to work for you instead of the other way around.
If you’re new to the Linux command line and feel lost, read on for more tips on getting the most out of your Linux system with the shell.
You can do a lot of amazing things with commands in Linux and it really isn’t hard to learn.
About the Author