You are here

Linux Quick Reference Guide

Provides an introduction to using Linux commands.

Getting Started

Linux is a popular operating system that is available at Temple on three central computer systems: (high performance computing cluster), (research system for SAS programmers), and (general user website and programming).

Astro is a general user system. All students, faculty, and staff have access to Astro by default. To obtain access to the High Performance Computing cluster or, send an email to the HPC support team at

You can access your Linux account in a computer lab or through a secure telnet program, such as SSH Secure Shell available at Temple's Download web site.

Once you have logged on, you will see a system prompt where you type Linux commands.

Keep in mind that Linux commands are case sensitive. This means that you must type commands exactly as they appear, paying attention to upper and lower case letters.

File and directory organization

Upon logging in, the system places you in your home directory. The full home directory path has a subdirectory listed with a letter and number and then another subdirectory named after your login name. For example, if your login name is jroscoe, your home directory could be: /home/a003/jroscoe where the home directory has a subdirectory called a003 and within a003 there is a subdirectory called jroscoe. The letter and number for the a003 subdirectory will vary since it is just a way for the system to randomly group users so everyone is not in one giant directory.

The directory which you are currently in is referred to as your working directory. Unless you change to another directory, your working directory will be your home directory. To view your current directory, type pwd (stands for print working directory) at the system prompt and press Enter. To see a list of files and subdirectories in your current working directory, type ls -F and press Enter. The -F will display directories as items followed by a slash (/). All other items are files.

On Temple's Linux systems, you can store files and create directories only in your home directory or the /tmp directory. To create a directory within your home directory type mkdir (stands for make directory) and specify the directory name. For example, you might type mkdir test. Then, type ls -F to verify that a new directory called test was created. To change to the new directory, type cd test. To confirm that you are in the test directory, type pwd. Assuming your home directory is /home/a003/jroscoe, you should then see: /home/a003/jroscoe/test. To move back one directory (for example, to return to the jroscoe directory), type cd .. and press Enter. Note that there is a space between the cd and the two periods (..). To go to your home directory from any other directory, type cd (stands for change directory) and press Enter.

Using Files

The purpose of a directory is to store files. Files, in turn, are used to store information. Linux filenames can be made up of any combination of letters and numbers but should not include spaces or special characters such as *, &, and @. When files are created, Linux maintains the following information about them: creation date, modification date, access date, size, ownership, security, links, and type.

After creating a file with an editor such as pico (Astro only), nano (HPC and Compute), or vi (see section IV), you can type ls -F to verify that the file was created. You can view the contents of the file by typing cat filename or more filename and pressing Enter. If you use the more command, the system will display one screen of the file at a time. To proceed to the next screen, press the Spacebar. To exit before viewing the entire file, type q.

Creating files using pico or nano

The pico editor is available on Astro. The nano editor is available on HPC and Compute. Alternately, vi is available on all these systems. You can use these editors to create and modify files.

The pico and nano editors are simple, straightforward programs useful for basic text editing. The vi editor is a standard Linux program that offers more features than pico but takes longer to learn.

If you are using Astro, this section will cover the basics of pico. To use vi, see Educational Bulletin E-310, Unix Editor (vi).

Using the pipe symbol

Using the pipe symbol (|), located above the backslash key (\), you can send the output of one command into another command.

For example, suppose you type ls to list the files in your home directory, but you cannot read them all because they scroll by too quickly. To display this information one screen at a time, you can pipe the list to the more command by typing ls | more and pressing Enter. Then press the Spacebar to proceed through each screen.

Using the history file

The history file, by default, keeps track of the last 40 commands you have issued. As a shortcut, you can use the history file to reissue commands instead of retyping them.

To reissue a command, type history | more at the system prompt and press Enter. The system will then display a list of commands preceded by a number. To reissue a command type !n and press Enter, where n is the number of the command you want to reissue. For example, to reissue command 32, type !32 and press Enter. (If your account is set to the enhanced c shell (tcsh), you can also press the down and up arrow keys to retrieve the last command that you typed.)

Using online documentation

To learn more about a Linux command, you can read the extensive online documentation provided on the system. To do this, type man command at the system prompt and press Enter. For example, to obtain information about the ls command, type man ls and press Enter. Then press the Spacebar to proceed through each screen or type q to exit.

If you don't know the name of the command, you can have the man program search the online documentation for similar entries. To do this, perform a keyword search using the -k parameter. For example, if you want to know the command for changing your password, type man -k password and press Enter. After viewing the keyword list, you can determine the proper entry (in this case, passwd) and read the man page. To exit before reading the entire keyword list, type q.

Logging off

To log off the system, type exit at the system prompt.