All the following example UNIX commands are issued from the GPU system prompt, i.e.:
gpu {yourID}:
To get to the system prompt from the main Lynx menu, type q and respond with a y to the prompt "Are you sure you want to quit? [Y]."
Cancelling Commands
Before you start experimenting with UNIX commands shown below, one keystroke
combination which will prove invaluable is Ctrl-c (hold down the Ctrl key and
type a letter c). This is the UNIX cancel command; it can get you out of lots
of difficult situations. Also remember that the UNIX operating system is case
sensitive so all commands are typed in lower-case letters.
- a mixture of letters and numbers
- a mixture of upper- and lower-case characters
Good passwords are not easily guessed. For example, do not use your name spelled backwards as your password, nor your dog's name, nor a word that can be found in the dictionary. You can use two words separated by either a number or a punctuation symbol, or a word and number combination.
The command to change your password is:
passwd
When you issue the passwd command, you are prompted for your existing password and a new password which you are asked to type in twice.
The following command indicates the percentage of your disk space in use:
fs quota
The following command provides extra information about your disk quota and the amount you have in use:
fs listquota
UNIX directories are analogous to Macintosh folders and MS-DOS directories. When you first log in to GPU, you are in your home directory by default. To see a list of files and directories in your home directory, type:
ls
Press the Enter or Return key. A list of files and directories in your GPU ID/account will display. A directory can be identified by the forward slash (/) at the end of its name. On your ID you should see a Mail/ directory, where e-mail messages you send or save are automatically stored. There will also be a News/ directory in which any news articles you save are stored.
The basic ls command does not give any detailed information about your files or directories but by adding options to the command you can get additional information. In UNIX, an option for a command is indicated by a letter preceded by a hyphen; the hyphenated letter is separated from the command by a space, as in:
ls -l
This command lists the directory contents in long format. Information similar to the following is displayed when you issue this command.
total 3 -rw------- 1 jdoe staff 1024 Sept 4 10:35 filename drwxr-xr-x 2 jdoe staff 2048 Jan 24 11:28 Mail/ drwxr-xr-x 3 jdoe staff 2048 Jan 23 09:28 News/
The first line in the displayed information tells how much disk space (measured in blocks) is used for these files, followed by one line of information for each file or directory which is divided into six columns. In the first column of each line, the first character in the series of dashes and letters shows if the entry is a file (indicated by a dash) or a directory (indicated by the letter d). The additional letters and dashes indicate who has permission to look at or use the file. The second column gives the number of links to a file or directory, followed by the owner's logon ID. The third column indicates whether the user is a staff member or a student. The fourth column shows the size of the file or directory in bytes. The fifth column lists the date and time when the file/directory was last changed, and the sixth column lists the name of the file or directory.
There are other hidden files in your home directory which are used by the UNIX operating system. To see a list of these files as well use the command:
ls -la
The GPU system uses the Andrew File System (AFS) for some operations related to working with files and directories. As mentioned earlier, when you first log on to GPU you are placed in your own home directory. To see the AFS form of your home directory's pathname, type the print working directory (pwd) command:
pwd
The pwd command shows where you are in the directory structure. For example, if the GPU user John Doe issues the pwd command while in his home directory, the returned information is:
/afs/ualberta.ca/home/j/d/jdoe
The cd (change directory) command is used to move from the current directory to another directory:
cd directory-name
For example, to move to the Mail directory type cd Mail and press Enter or Return. To see a list of files in the directory you have changed to, use the ls -la command. If you have sent any messages, you should see a file called sent-messages and if you have saved incoming mail you will probably see a file called saved-messages.
To move back up to the previous directory, type:
cd ..
Press Enter or Return and you move back up one level in the directory structure. To move back to your home directory, regardless of which directory you are currently in, use the command:
cd ~
There are many occasions when you may wish to create a new text file on the UNIX system. A UNIX text editor such as Pico, vi, or emacs can be used to do this. Pico, probably the easiest editor to use, can be used from the UNIX command line to create a new file:
pico filename
This command takes you into the Pico text editor. The area at the bottom of the screen shows the basic Pico commands. The caret symbol (^) indicates that the Ctrl key must be held down while pressing the appropriate letter. Press Ctrl-x when you have finished typing the file, respond with y at the "Save modified buffer" prompt, then press Enter to accept the filename shown. You may also start Pico without specifying a filename, create a file, then name it when you exit.
While you can save all your files in your home directory, there are a number of reasons why you may want to create other directories and store related files in them. For example, you may want to save all messages you receive from a particular person in a separate directory, or you may want to create a directory where you can share files with a particular user.
To create a new directory, use the mkdir (i.e., make directory) command:
mkdir new-directory-name
The new directory will be created one level below the current directory you are in, so it's a good idea to first use the pwd command to make sure you are where you want to be in the directory structure.
To create a copy of a file or directory, use the cp command. For example, to create a duplicate of a file called file-one, type the command:
cp file-one file-two
There will now be two copies of the file, one called file-one and another called file-two.
The mv command (i.e., move) is used to rename/move files/directories. To rename a file:
mv old-filename new-filename
To both create a new directory and move all the files from an existing directory into the newly created directory, use the command:
mv old-directory-name new-directory-name
The rm command is used to remove or delete a file. Type:
rm filename
Respond with a y for "Yes" when prompted. To remove more than one file at a time, use the rm command followed by a list of filenames separated by spaces.
The rmdir (i.e., remove directory) command is used to get rid of directories you no longer want:
rmdir directory-name
Directories must be empty before they can be deleted.
cat filename
If the displayed file is very long, it will fly by on screen until it reaches the end of the file. The more command is used to display one screenful at a time.
The more command can be used in two ways. The first way, shown below, displays one screenful of the contents of a file at a time:
more filename
A prompt at the bottom of the screen, i.e., -More- (?%), indicates how much of the file has been displayed. To see more of the file you can:
cat filename | more
The pipe-more sequence can be used with just about any UNIX command to pause its display on screen. For example, if a list of files is quite long they will fly by on screen. To prevent this, type:
ls -la | more
who | more
To display this information just about yourself, type:
who am i
To create your own .plan file, first make sure you are in your home directory by typing:
cd ~
Now create the file using the Pico text editor:
pico .plan
Type any information you want others to see; include a favorite saying or poem, or create an ASCII graphic on screen using lines, dashes, slashes, and letters, then press the Ctrl-x key combination to save and exit. Follow the same steps to create a .project file if you wish.
You may also wish to create a dot file called a .signature file which displays at the bottom of all your e-mail messages or Internet news postings. This file must also be in your home directory and is created in the same way as a .plan file:
pico .signature
Your .signature file may include your real-life name, your e-mail address, phone number, campus address, and any other information you want to include. When you are done typing, press the Ctrl-x key combination to save and exit. You may want to start your .signature file with a line of dashes or stars to separate the .signature information from the body of the e-mail message or newsgroup article you are posting.
To send an immediate message to someone else who is logged on, type:
write their-logon-ID
Each line you type after issuing the write command will appear on the recipient's screen until you press the Ctrl-c key combination to end the transmission. In effect, your message interrupts your correspondent's work.
While the write command is limited to one-way communication, the talk command initiates a two-way conversation. To request a talk session with another user who is logged on, type:
talk their-logon-ID
The recipient is notified that you wish to have a talk session; the recipient in turn may go to the GPU command line and respond with:
talk your-ID
Each line you type after issuing the talk command will appear on the recipient's screen. When you want to end the conversation, press the Ctrl-c key combination.
There are a couple of things to remember about the write and talk commands:
If you don't want to be interrupted by someone writing or talking to you, type:
mesg n
If someone tries to talk or write to you after you have issued the command above, they will receive the message [Your party is refusing messages].
If and when you want to receive write and talk messages again, type:
mesg y
To see the write/talk setting currently in effect on your GPU account, type:
mesg
The different types of directory access control rights you can grant to others include:
fs listacl ~yourID
To grant another person the right to read files in a directory in your GPU account, use the command:
fs setacl ~/directory-name person's-logon-ID rl
To grant another person the right to read files in your directory and copy files to your directory, use the command:
fs setacl ~/directory-name person's-logon-ID rli
For a more detailed explanation of ACLs and access control rights, see the help information on Using the Andrew File System.
Here's another useful collection of helpful information for new UNIX users.
As with all Lynx screens, you can save the help screen you are currently viewing to a file by typing the letter p. You will then be presented with a number of choices:
1. Save to a local file
2. Mail the file to yourself
3. Print to the screen
Where you are and how your computer is connected will determine which option you should choose. If you choose option 1, the screen will be saved as a file in your GPU ID, which can then be downloaded and printed on your PC or Macintosh. If you choose option 2, the file will be mailed to you; from your e-mail program it can be saved, downloaded, and printed or mailed to someone else. Option 3 will print the contents of the file to your screen, but since you are already looking at the file's contents, the only time this is useful is if you are saving your GPU session to a log file.
The UNIX manual pages (i.e., man pages) that come with the operating system also provide on-line help. To access the man pages, use the man command followed by the command you want help on. For example, if you want information on pico, type:
man pico
Man pages can also be searched by keywords. If, for example, you want to see the documentation for copying files but can't remember the command, type:
man -k copy
GPU will search for any commands including or relating to the word copy.