A Command Line (or Shell) Tutorial
Many beginning programmers will sooner or later run into the problem of figuring out how to use the a command line to configure various applications and to run programs like WordPress or Ruby on Rails. In fact, even programming tutorials for beginners rely on websites like Nitrous.io, that have command line interfaces built into them. Any kind of serious programming will require some knowledge of the command line, and that need becomes more acute when you are trying to get stuff done on a computer without buying expensive “Graphical User Interface (GUI)” software.
So what is the command line? In this tutorial, we will cover some basic concepts for beginners, and then point you to the enormous wealth of material on the Internet where you can learn more, once you’ve picked up the basics.
The command-line interface, sometimes referred to as the CLI, is a software application like any other on your laptop, into which you type in commands as strings of text, in order to perform many of the same tasks that you might be ordinarily accustomed to do with by pointing and clicking your mouse on menus and buttons.
Why The Command Line?
If you like solving puzzles, the command line is for you! It will give you a great set of tools with which you can get much more control over your computer than any GUI can give you.
But a more important reason is that if you are serious about being a programmer, then the command-line is an essential part of your toolkit, the scalpel and suture to your surgeon. It is important to understand that learning to program is like getting comfortable with a very big, digital, Meccano kit: you will have to learn how to be a master builder, and knowledge of the CLI is unavoidable in getting there.
If you have been using WordPress.com for a blog and are ready to install your own blog, you’ll need to use the CLI. If you are trying to use Amazon’s web service to run a website, you’ll need the CLI. If you’re getting tired of analyzing large files of data by hand, and want to figure out a way to automate past the frustration – you should think of using the CLI.
Brass Tacks: Locating the CLI
If you have a laptop, you are most probably running either a Microsoft or an Apple operating system. They both have their own command-line interface application – on Microsoft’s Windows OS, it’s called the Command Prompt, and on Apple OSX machines, the default application is called Terminal.
In this tutorial, we will focus on Terminal, because it is based on command line interfaces that are commonly used in the programming world, and uses similar concepts. These interfaces all came from the design of an operating system called UNIX, and of its descendants. Microsoft’s Command Prompt is in a world of its own, and while some of the concepts overlap with those of UNIX systems, there are more differences than similarities.
The ~# is called the command line prompt, or more simply, the “prompt.” It tells you that the command line is waiting for your input, which you have to type in. It also tells you that you are in your “home” folder.
We will make a concession here, even though we said we wouldn’t reference Microsoft’s products – here’s what you would find if you started the Command Prompt application. We are doing this to show how the two are fairly similar – after all, Gates and Jobs both shared the same inspiration when they developed their two companies.
No Place Like Home
To understand the home folder, we have to understand two concepts about the command line – users and the folder hierarchy.
So to start – what are users? All computer systems today require that the person using it identify themselves in some fashion. Sometimes a computer might have a “guest” login, which allows you to use it “anonymously,” which typically means, without a password. However, the “guest” user is still a user in its own right.
Every user has a “home folder (or directory.)” 1)We will use folder and directory interchangeably in this tutorial. Both Windows and OSX will arrange separate folders for each user on the computer, limiting “edit access” to a home folder to the user that “owns” it. Usually, the default behavior is that all users can read most of the contents of each others’ home folders, but they are not allowed to change the contents of each others’ home folders.
References [ + ]
|1.||↑||We will use folder and directory interchangeably in this tutorial.|