Just Enough Command Line for Installing

Tom Taylor edited this page Oct 12, 2015 · 2 revisions
Clone this wiki locally

This is your friend.
It goes by various names: terminal, command line, bash, shell, PowerShell; and looks a little different in each operating system.

Window’s Command Prompt Mac OS X’s Terminal
Window’s Command Prompt Mac OS X’s Terminal

Open a Terminal Window

In Windows:
In the Search box, type "Command Prompt", then in the list of results, double-click Command Prompt.
In OS X:
Open the Applications folder and then the Utilities folder. Click on Terminal.app
Window's Search box icon for Mac's Terminal app

The Current Working Directory

The lowest line in the terminal displays the current working directory--the folder that can be affected by any commands that are entered at the command line.

Command Prompt with current working directory circled Terminal with current working directory circled

The Command Prompt

Following the current working directory is a character that indicates where the command line begins. This is the command prompt. In Windows, it is the greater-than sign: >; in OS X and Linux, it is a dollar sign: $.

Regardless of which operating system is being used, coding instructions sometimes indicate a command by preceding it with the dollar sign.
$ npm install -g grunt-cli
The dollar sign is not typed as part of the command.

Command Prompt with typed command Terminal with with typed command

Running a Command

After typing your command on the command line, press Enter or Return.

Sometimes the commands you run in the terminal need to be run by a user with elevated permissions...

To run a command with elevated permissions:

In Windows:
The technique you use will depend on your version of Windows. This guide explains different ways to open a command prompt as administrator in Windows.

In OS X:
Open a terminal in the usual way. Begin your command with sudo followed by a space, as in the following example.
sudo npm install -g grunt-cli
If sudo does not work, consult your systems administrator.

What if I enter a misspelled command?

Generally speaking, the program will report back with an error message or tell you that the command was not recognized. Read through the message to determine if it was caused by an innocuous typo or by something more serious. If simply a typo, retype your command and try again.

Interrupting a Command

When a command finishes, it returns control to the command prompt. The command prompt will reappear, and you’ll be able to enter another command. Sometimes a command starts a process that seems to get stuck or encounters an error. It does not look like it will ever return to the command prompt.
To interrupt a process, press: Ctrl+C
Take responsibility for your own actions because using this command in certain circumstances can have undesirable consequences, such as computer crashes and lost data.

Navigating Folders

Most often a command needs to be run within the folder that contains the file that understands the command. In other words, the current working directory associated with the command prompt needs to be the folder that contains that file. If it is not, you need to navigate to it.

To list the contents (both files and folders) of the current working directory:

ls (in OS X and Linux)
dir (in Windows)

To change to directory that is within the current working directory:

cd directory-name

To change to subdirectory:

cd directory-name/subdirectory-name

To move up to the folder that is the parent of the current working directory:

$ cd ..

To view previous commands entered:

Use the keyboard's up and down arrows.

To exit the terminal window:

$ exit

Using version number to determine if a program has been installed:

If a program is installed, it typically has the ability to report its version number. If it is not installed, your computer will not recognize the commands.

The following commands will return version numbers for key programs used by Adapt.
git --version
node --version
nodist --version
nvm --version
npm --version
ffmpeg --version
mongod --version
grunt --version
adapt --version

There are many resources on the web that give more thorough explanations of terminal commands. Please access them. This short explanation is provided to make installation easier.