Friday morning October 31, nanoHUB tools and home directories will be unavailable from 6 AM to noon (eastern time); we're getting a new file server! All tool sessions will be lost. Also, the web site will be unavailable for about 15 minutes sometime between 8-9 AM. close


Support Options

Submit a Support Ticket


Introduction to the Unix command line

by Benjamin P Haley


Most popular computer operating systems, like Microsoft Windows and Mac OS X, offer primarily (but not exclusively) graphical user interfaces. The user interacts with files and programs by pointing and clicking with a mouse. Unix, which is a considerably older operating system than Windows or OS X, also offers a graphical user interface (more than one, actually), but Unix originally presented a command line interface, in which the user interacts with the operating system by typing commands at a text prompt and reading textual output from programs. The command line interface is alive and well in Unix today, and many Unix users consider it the most powerful and efficient system for basic operations like navigating through directories and handling files.


In this document, we use the term Unix to refer to a family of operating systems. The look and feel of the graphical interfaces of these systems, as well as the file system layout, may differ significantly from one system to the next, but they all have their (conceptual) roots in the original Unix developed at Bell Labs. This family of operating systems includes Linux (also called GNU/Linux) distributions like Debian, Red Hat, and Ubuntu, as well as Sun Solaris. Mac OS X is a curious case; many of its users never touch the command line interface, but all the commands described below are all available in OS X. Many entertaining arguments about whether OS X is a true Unix can be found in programmer internet forums. Microsoft Windows offers a different command line interface than Unix, but a program called Cygwin provides a Unix interface for Windows.

We also use the abbreviation OS to mean “operating system”.

Opening a Terminal

In a modern Unix OS (that is, one with a graphical user interface) the command line interface is accessed through a program called a terminal. Below we show how to run a terminal program in some of the more popular graphical Unix environments, including GNOME and KDE, available in most Linux distributions, as well as Mac OS X.


In the GNOME desktop, click the Applications menu (typically in the upper left corner); in the Accessories menu, choose Terminal.


In the KDE desktop, click the main menu (with K superimposed over a gear), typically in the lower left corner; in the System menu, choose Konsole (the KDE terminal program).

Mac OS X

In a Finder window, choose the Utilities folder.

In the Utilities folder, select the Terminal application.

A new window

You should see a new window on your screen, with a prompt and possibly a cursor. The prompt might be a simple character, like $ or %, or it might be the name of your computer and a number showing how many commands have been entered, like coates[1]. Regardless of the color of your window or cursor or the wording of your prompt, this terminal window is a Unix command line interface.


The prompt you see in the terminal window is the initial output of a program called the shell. The shell is the Unix command interpreter (it is actually a separate program from the terminal window program, but the shell starts automatically when a terminal window opens). Unix offers several different shells, but for most of what we cover in this document, the differences between the shells are negligible.

The shell reads the characters typed next to the prompt in the terminal, until Enter or Return is typed. After Enter or Return, the shell interprets all the input characters as a command, runs the command, and returns any text output from the command to be displayed in the terminal.

The next section introduces the basic Unix command line utilities, programs designed to do one specific task. The example images show a grey terminal window with black text and a prompt of the form coates[N], where N is the number of commands which have been entered already.
(Image(sample_terminal.png) failed - File not found)

Basic commands

ls, pwd, cd, man, rm, mv,


Other useful Topics

Other websites

Created on , Last modified on, a resource for nanoscience and nanotechnology, is supported by the National Science Foundation and other funding agencies. Any opinions, findings, and conclusions or recommendations expressed in this material are those of the author(s) and do not necessarily reflect the views of the National Science Foundation.