A Guide to UNIX
- Unix Commands
- Panicking in Unix
- Logging Out of Unix
- Email in Unix
- Creating a Directory
- Removing a Directory and its Contents
Items enclosed in <> are variables, meaning you should type in the name you want but not the <>. Items in courier are commands. The ^ means press the control key and the command letter at the same time. All commands are typed at the Unix prompt; press Return after them, unless otherwise noted.
manis the most important UNIX command. It displays a complete help page on a given command.
- Press Return to scroll down one line.
- Press B to scroll up one screen.
- Press up and down to scroll normally.
- Press Q to quit and return to the prompt.
passwdwill let you change your password. Good passwords are at least 7 characters in length, and are made up of numbers, letters, and symbols.
lessare text viewers. They show you the contents of a file one screen at a time in plain text. Pressing space displays the next page. Usage:
jobswill list the number and type of jobs you currently have running. For each job listed that you would like to quit running, type
kill <jobnumber>, where
<jobnumber>is the large, unbracketed number next to the job name.
^C(control-C) kills whatever process you've recently started if you don't know how to quit it.
^Z(control-Z) suspends whatever program you're currently running and puts you at the Unix prompt so you can do something else. Type fg to get back into your program.
lslists the files in the directory you're currently in.
ls -alists all the files in that directory, including the ones which start with a "." (like .profile).
ls -llists detailed information of each file.
du -kdisplays the amount of disk space your directories are using in KB. Remember to keep your directory within the disk quota (100000 KB is standard).
du -ksgives the summed total of your home directory files and
du -ks /usr/spool/mail/<login>gives the total for your mail inbox.
cpcopies a file. Usage:
cp <source file> <target file>.
mvmoves a file. Can also be used to rename a file. Usage:
mv <source file> <targetfile>
rm -iremoves a file. Usage: rm -i <filename>
cdmoves you between directories. cd by itself takes you "home." Usage:
pwd(print working directory) tells you what directory you're currently in.
lpr -P<printername> <filename>prints a postscript file. Note the lack of a space between —P and the printername.
enscript -P<printername> <filename>prints a text file (this includes email files).
gzipcompresses the file you specify. After compression, your file will have a .gz suffix. Usage:
gzip <filename>. You can use
gzip -9to compress your file almost 90%. Default compression is 50%. Be patient; the bigger the file, the longer it will take.
gunzipuncompresses a file with a .gz suffix. Usage:
uncompressuncompresses a .Z file. Usage:
tar -xvfuncompresses a .tar file. Usage:
tar -xvf <filename.tar>
ipinelets you read and send email. Your command options are at the bottom of the screen. For more information, see E-Mail in UNIX.
trnlets you read and post to USENET newsgroups. The command
l <topic>will show you a list of those groups that have that word in their name.
g <newsgroupname>subscribes you to a newsgroup.
uunsubscribes you from the newsgroup you're in.
hgives you help by listing the available commands. Read about netiquette before you post news.
qto quit either of these programs.
Word Processing in Unix.
- pico: This is the editor pine uses to compose messages. The commands for Pico are at the bottom of the screen. Using pico -w keeps pico from adding line breaks as you type.
- emacs: A relatively simple text editor in Unix.
- vi: The text editor used by more Unix veterans than any other. Its interface can be difficult at first.
Reed's Unix machines are multi-user and networked. The following commands will help you to use these facilities.
whotells you who is currently logged on at Reed and what time they logged in. There are several commands that can give you similar information: u, w, and finger.
fingerlets you see someone's finger information such as their real name. Not all sites allow finger access. Usage:
lynxis a text client for the World Wide Web. It reads all the text portions of an HTML document, but doesn't show pictures nor does it handle frames well. Usage:
lynx <web page address>.
ftpis a file transfer protocol program that lets you access archives of all sorts of information. Note: ftp is not necessarily secure. For a more secure version of ftp, see sftp below.
Telnetallows you to login to a remote computer via a text interface. It is most popular for logging into Unix or Linux workstations, but macOS also has telnet receiving capabilities. Telnet is very insecure, and if at all possible you should use ssh over telnet. Usage:
telnet <machine name>. Note: Telnet is not supported on the Reed machines. Use SSH instead.
sshlets you access remote sites. ssh should be used to move between the Unix machines on campus. To use, type ssh and the name/address of your intended destination. For more information, see SSH in Unix. Usage:
ssh -l <login name> <machine name>or
ssh <login name>@<machine name>.
mangives you a "manual page." This is the on line help for using Unix. These pages are not, however, the easiest thing to read and understand. Their most useful purpose is to list out all the options you can add to a command. For example, try
man ls. Usage:
apropos <subject>will give you a list of possible commands on your listed subject.
- UNIX can be a scary place, since it is almost impossible to undo changes. If you get to a point where you are afraid you might do damage, hit
^C( Control-C). A lot. It is the universal panic command — it will escape any program that is running and return you to the prompt.
- It's very important that you always log out completely and correctly. If you don't it's possible for people to get into your account and wreak all sorts of havoc in your name.
- At the prompt, enter the command logout or hit ^D (Control-D).
- If you are running Terminal from macOS, type logout again to close the window.
You can send electronic mail (e-mail) to other users on campus or users at other locations around the world. To send e-mail to someone on or off campus, you must know their email address. Your UNIX e-mail address is
<yourlogin>@reed.edu. To get started, type ipine at the % prompt. Notice that Pine always lists your command options along the bottom of the window.
- To compose a letter to someone while in Pine, press c (for compose).
- After "To:" type in the email address.
- After "cc:" type in the login or address of someone who is to receive a carbon copy of your message. If you don't want a carbon copy sent just press Return.
- Type a short description of the subject of your letter after "Subject:"
- Now type your letter.
- When you have finished your letter press ^X to send it.
Note: Using a person's name rather than their UNIX login is the best way to address on-campus e-mail. For more information about addressing e-mail at Reed, see the Communication Handbook. When the message is sent to someone at Reed, the mail program checks the Domain Name Directory for the best place to put your message. Using names or part of names works for mailing lists, students, faculty and staff -- but alumni only have a UNIX login and thus cannot send or receive email through Reed pine except to their Reed alumni forwarding account.
To check your UNIX mail once you have opened Pine:
- Press i to see an index of the e-mail messages in your Inbox.
- You can move up and down the list of messages with the arrow keys pressing Return to tell pine that you'd like to read the message you've selected.
- After you've read the message you can tell pine what you'd like to do with the message you've just read: d to delete it, s to save it into a folder in your home directory, r to send a reply, or n to view the next message.
- Suppose you want to create a directory named mydir.
- At the prompt, enter the command
mkdir ~/mydir, or
mkdir <directory>in general.
- Suppose you want to delete the directory ~/mydir.
- At the prompt, enter the command
- If you are sure you want to delete the directory, type
yand hit Return. Otherwise, type
nand hit Return. Beware: there is no "Recycling Bin" in UNIX; when directories are deleted, there is a good chance they and their contents are gone for good.