Webguide Home | Search
New York University

Web Site Development

Common Command and Control Sequences

Common Commands

The following commands can be entered at the UNIX system command prompt. Press the <Return> key after each command. Use lower case letters unless otherwise indicated.

Command Description
Working with Directories
pwd Gives you the name of your current working directory.
cd dirname Changes your working directory to dirname. If you are not in dirname's parent directory, you must use dirname's full pathname.
cd .. Changes your working directory to the parent of the directory that you are in when you issue this command. If you are at the root, you will remain there.
cd Changes your working directory to your home directory.
ls Lists the files in your working directory.
ls -l Lists the files in your working directory, giving lengthier information about them — including file protection and access privileges.
ls -a Lists the files in your working directory and shows your hidden "dot" files, as well, including your .login file.
ls -lt Same as ls -l, but orders the files by time modified.
mkdir dirname Creates a directory called dirname.
Your working directory will be the parent of this new directory, unless you specify another pathname.
rmdir dirname Deletes a directory called dirname, if the directory is completely empty. If you are not in dirname's parent directory, you must use dirname's full pathname.
Working with Files
pico filename Uses the editor Pico to open a file called filename. If a file of that name does not already exist, it starts a new one. See section on Pico.
vi filename Uses the editor vi to open a file called filename.
cp file1 file2 Makes a copy of a file called file1 and names the copy file2. If there already is a file called file2, it will be replaced.
cp -i file1 file2 Makes a copy of file1 and calls the copy file2. If there already is a file called file2, the system queries you before replacing it.
rm filename Deletes a file called filename.
If you are not in the same directory as filename, you must specify filename's pathname.
rm -i filename Deletes a file after confirmation. Type y to confirm, n to cancel.
more filename Lists the contents of the file called filename on your screen. Press the spacebar to scroll forward in the file. Type b to scroll back one screenful. Type q to quit.
lpr -P pr fname Sends a file called fname to a printer called pr.
Additional Commands
history Lists your previous commands (the default at NYU is 20 of them). !n Executes command number n in the list that you receive as output of the history command.
man command

Obtains online information about the command of your choice. These are the UNIX system's online "man pages".

Press the spacebar to scroll to the next screenful. Type b to scroll back a screenful. Type q to quit the man facility.

man -k key Obtains online information when you do not know the command name. Replace key with a keyword for the function you wish to perform.
learn Initiates online instruction in file manipulation, vi, C, and other topics.
passwd Initiates the password-changing program. Respond, as prompted, with your old and new passwords.
pine Starts the Pine mail program. See the section on mail.
tin Starts the network news reader tin Use the up- and down-arrow keys to highlight a newsgroup (or message) of interest; press Enter key to select it. Type ? for help, and q to quit.
logout Logs you off the UNIX system.
If you have a "stopped process", the system will prompt you. Enter fg to resume the process or logout a second time to abort the process and log off the system.

Keys and Terminal Emulation

In the following, a caret (^) indicates the "control" key (often marked CTRL or CTL). Hold the "control" key down while typing the letter shown next to it.

Command Description
Backspace To backspace, use the backspace key (often marked BKSP) or, if that does not work, the delete key (often marked DEL).
^c Aborts the current process — e.g., a long screen listing.
^s Temporarily suspends a listing until you type ^q.
^q Resumes a listing after it has been suspended with ^s.
tset -s vt100 > termenv
source termenv
Together, these two commands tell the system to treat your keyboard input as if you were using a vt100-type terminal. This will help ensure that your Pico and vi commands and control key sequences are properly understood by the system.
More Control Key Sequences (Advanced Usage)
^u Erases the whole line of characters you have typed thus far at the command line.
^d This is the end-of-file indication.
^z

Suspends the execution of a process ("a job"). You may then have the process continue in the background (type bg immediately after). Type fg to resume the job or bring it to the foreground. To kill a suspended job, type jobs, then kill %n, where n is the number of the suspended job.

Use of this suspend character should be avoided until you have some familiarity with the system.

^l Redraws the screen.

On this page...