This talk is an introduction to using a Linux terminal. The material has been tailored to the shell offered by unix.andrew.cmu.edu (csh), though most techniques will be applicable on any Linux or Unix-based system.

Getting Started

Throughout this guide, we will ask you to run various terminal commands on your Linux system. These commands will be set off from the rest of the text in gray boxes, like the one shown below:

$: echo Hello World

At the beginning of each line, you will see the symbols $:. These symbols indicate the start of each command, and should not be typed into the terminal.

You may not have access to a Linux system on which to follow along with this tutorial. We highly encourage you to connect to unix.andrew.cmu.edu using ssh (Mac OS X) or PuTTY (Windows) so that you can follow along as we go through the basics of using a terminal.

Using SSH (Mac OS X)

Open Applications/Utilities/Terminal, and type the following command, replacing ANDREWID with your andrewid.

$: ssh ANDREWID@unix.andrew.cmu.edu

You will be asked to enter your password. Type in your andrew account password and press enter (you will not be able to see your password as you type).

Using PuTTY (Windows)

Download PuTTY from its developer and launch the program. You will be asked for the server to connect to: unix.andrew.cmu.edu. PuTTY will attempt to connect, and then ask you for your username and password, which are the same as your andrew username and password.

Basic Commands

Navigation

To Create and Destroy

The UNIX Philosophy

You may have noticed that a lot of the tools we used just now are very simple compared to many computer applications with which you are familiar. This is not an accidental decision.

UNIX programs strive to embody a few simple ideals:

  • Do one thing and do it well.
  • Work together with other programs.
  • Don't be surprising.
  • Be general.

These principles are good for developers, because each program is easy to understand, and therefore easier to design and implement. They are also good for users, because simple programs that work together allow users to solve their own problems, rather than waiting for a developer to bless them with the tools they need.

Already you've seen that tools do one thing, you've seen that they are quite unsurprising, and you've also seen that they can be very general. We haven't yet looked at how you, the user, are supposed to get these independent chunks of software to work together. This is the role of operators.

Operators

Redirection

Pipes

Evaluation

Advanced Commands

How to Get Help

Searching

Status

Fun with Strings

Shell Built-Ins

Process Control

History

Environment