Introduction to Command Line

These articles have accompanying YouTube videos, here.

Most of the average computer user’s interactions with their systems take place within the confines of a graphical user interface (GUI). This is the pretty, familiar landscape of windows, buttons, menus, and textboxes, that we inhabit the majority of the time that we are using a computer. However, there are certain tasks that either cannot be done in this environment, or that can be done more efficiently on the command line.

Although you can function on a computer without it, the command line provides a more efficient mechanism for completing a lot of common tasks. While this is especially true for more technical tasks like programming or systems administration, the command line can be a useful tool even if your use case is a little more “normal”. With a bit of know-how, even tasks as mundane as creating backups, extracting zip archives, or downloading files from the Internet can be performed quite quickly and easily using a command or two.

This short series of articles, will introduce you to the core concepts of working in a command line. It is my hope that anyone can extract some value out of this, irrespective of what they use a computer for.

Because the majority of desktop computers run Microsoft Windows, this series uses Command Prompt. This is to reduce the barrier to entry, as anyone with a Windows computer can open the program and follow along with no additional setup whatsoever. The majority of the concepts discussed are universal, and so should be directly transferable to more sophiscated command line environments such as Bash or PowerShell.

Chapters

  • The Command Prompt

    In order to discuss the command line, we are going to need a command line environment to use. This article introduces core concepts and vocabulary pertaining to the Command Prompt. If you are a detail oriented person, you may be best served skimming this article now, and then returning to it later for more detailed reading once you have a little more context.

  • Basic File Commands

    Now that we know a little bit about how the command line works, let’s learn how to use it to complete a variety of simple tasks. A common starting point is to use the command line for interacting with text files, and so that is what we will do next. In this article, we’ll discuss the basic structure of a command, and then see commands for creating, editing, viewing, renaming, copying, comparing, and deleting files.

  • Basic Directory Commands

    Our discussion of file commands was missing a very important aspect of the command line: our system doesn’t just include every single file thrown together in one directory! We must next learn how to deal with pathnames and directories.

  • Command Options and Wildcards

    In addition to accepting filename arguments, many commands will accept additional special arguments, called options, which can control their behavior. In this article, we discuss the concept of an option, various conventional syntaxes for specifying them, and how to access documentation on what options are available for a given command. We also discuss wildcards, a tool for quickly specifying multiple files to use an input to a command.

  • Environment Variables (coming soon!)

    A command line environment supports the storing of information within named variables. These can be used to configure programs running within a shell, or to modify the behavior of the shell itself. In this article, we’ll learn how to access and manipulate these variables.

  • Running Other Programs as Commands (coming soon!)

    A command can take the form of either a shell builtin, or a program However, running programs from the shell is not always as easy as installing it, and then typing its name. In this article, we’ll see how to set up any program we like to be executable from the shell.

  • Input/Output Streams and Redirection (coming soon!)

    There is more to input than arguments, and more to output than our terminal’s output buffer. In this article, we’ll learn how we can tell the shell to get input from places other than our keyboard, and write its output to something other than the terminal.

  • Command Reference Guide

    This document lists the Command Prompt commands discussed in these articles, along with their arguments and what they do. Arguments contained in square brackets are optional. Several of these commands accept more than three optional arguments, but only up to three are listed.