Whats the Deal With the Command Line?

Seems I’m missing out something cool!

This is the question I often get asked by my friends when they see me working on the command-line, not even caring about the cool graphical user interface (GUI)? Through this post, I hope to convince you to some extent on its beauty and its power, especially when it comes to accessibility.

What’s the command-line anyway?

To put this question in its proper context, let’s just say whenever you are working on your computer, every time you click a button, open a file, browse the web – virtually anything – you are issuing commands to your system. By system, I mean the operating system.

The ability to interpret your commands by the system mainly depends on how it understands them. To carry them out is often delegated to your installed programs or other utilities that come bundled with your system.

Now comes the interesting part: but how do you issue commands to the system?

While there is only one way your computer gets your commands, you as the user you have two alternatives to do that:

  • You either use the systerm terminal window, or the command-line; or
  • You use the graphical user interface (GUI).

We will be focusing on the first way, the use of the system terminal or the command line. To contrast it with the GUI, we can also refer to it as the CLI (Command line interface).

With the graphical user interface, you issue your commands to the system using its widgets or controls. These include such objects as buttons, menus, dialog boxes and so on. In short, the GUI represents your actions as objects that you are used to. All what you have to do is simply click a button to trigger an action, close a window to shut the program, stop the music to stop your multimedia player.

I think you get it.

With the command line on the other hand, you do not have those luxuries. Or should I say, you are not spoon-fed? 😄 Depends with how you see it.

In the command-line, you are presented with a bare terminal: you only have a line to receive your commands.

  • You should know the command you want.
  • In most cases, the command is simply a program that resides on your computer or some other function of the operating system.
  • You “invoke” that program or function by
    1. Typing its name,
    2. Passing the appropriate arguments to it.
    3. Wait for its output.
  • And that’s it!

Working with the command-line this way, you tend to understand its internals in a way you wouldn’t while working with the GUI. Why?

Because, if you followed the steps I stated above: almost every command you type on the command-line has this format: command arguments.

With arguments, you can pass in options to adjust the way these arguments are interpreted.

Well, every command is treated as a function. A function in programming is a piece of code that is invoked to carry out an action. For instance, a program may have functions for addition, multiplication, division etc. Any time, that program wants an addition to be carried out, it invokes that function, passing it the numbers to be added like this:

add(3, 9)

So if the function is defined in C like this:

int add(int a, int b) {
  return (a+b);

We will get 12.

But what does this have to do with working on the command line? It has everything to do with it. See how the above function within a program is invoked? This is done within the source code of a program when one function wants another function to do something: it invokes it.

Right, back to your operating system.

what you do at the terminal

The terminal is known as a command prompt on Windows, or terminal on Mac OS X or Linux. When you are at the command prompt, you are in a hierarchy of how programs work. Let’s follow up this hierarchy from the source code to your chair while watching, or listening to the command line. Okay?

  1. Within the source code, instructions are placed within function.
  2. If any part of the program wishes to have something done, it calls a function with those instructions, passing it any arguments it may require.1
  3. A program is installed on the operating system to provide certain functionality.
  4. If a user wants that functionality, the system calls that program passing it any arguments.
  5. The user calls the operating system.

Yeah, you call it from the command line or using a GUI. But from the command line, the process is similar to how programs call their functions, and how the operating system calls a program. Except that at the command line, you call the program directly, passing it any arguments.

So a command on the command line is either a function of the operating system itself or the name of a program. For example, to browse your filesystem, you use commands such as cd, ls, dir, cp, copy etc. All these are built-in functions of your operating system.

So getting the hang of it? Calling a function and calling a program by its name on the command line is just the same:

  • Some programs take arguments. You call them with the appropriate arguments.
  • This is the same as functions. Some have arguments and others do not.

This whole operation is what makes people think that working on the command line is like programming or system administration.

Administering your own system

I think one other thing that gives a geeky outlook to working on the command line may have to do with it being associated with system administration. Unfortunately, this is popularised by major companies and implies that working on the command line is better left to those trained in IT.

This could be true, or not true. Regardless of what it may be, but why not think of yourself as a system administrator of your own computer? You can troubleshoot any problems you run into on your own. I encourage you to consider exploring your own system in ways that give you more power than to wait on the bad days to hire someone to clean your system.

If you think of system administration, the next thing you find yourself doing is scripting your regular actions for them to be run from time to time. Scripting simply means writing your commands as you would on a command line. Instead of just opening a terminal, you create a text file, save those commands and give it an appropriate file extension.

You can then run those commands from within that file. That file is what we call a script.

There are many script types, depennding on the interpreter that handles your script:

  • You could be using PowerShell,
  • The Batch script (.bat),
  • the Bash script.

Yet regardless of which engine you use, the end product is the same: you write your scripts to automate certain repetitive tasks such as backing up your files, defragging your system, cleaning your recycle bin, running your antivirus program — we can’t list all the possibilities.

In short, all the house maintenance tasks are better left to your script, and run on the command line. You have better things to do rather than organising your new files into folders after downloading them from the internet.


This post was not a lesson into command line use or scripting: it was just a way to try to make you get started in this. There is nothing magical about working on the command line: you do not need a special training or skills. All what you need is to have your computer, some boring task you wish someone else would do for you, and a bit of aspiration. Scripting on the command line may not be programming per se, but it makes you understand how programs work. How they reason out bad from good logic. Who knows, you may start your way into programming by these simple actions of system maintenance?

In the next post, I will talk about task scheduling and its benefits. Until then, goodbye!

  1. A program, or function, can be called with or without arguments depending with the job it does. ↩︎