In general, one logs onto the Unix cluster from a telnet program. For now, if you are not familiar with how to do this, press here to log in. For more information on using telnet you can read the documentation on using telnet in the CHS/CUSD Computing Documentation Library .
[We should note here that "telnet" is an older, and much less secure way to connect to a remote host. Nowadays, we prefer to use a telnet-like system that supports encrypted sessions. The most widely used such system is called "Secure SHell" or SSH. There are many freely-available SSH clients that you can install on your workstation. You are STRONGLY encouraged to get and use a SSH client.]
You should now have a window on your computer screen with a login prompt for CHS. The window should look something like:
SunOS 5.7 login:
To login you must first type in your login name. This is usually your first initial followed by your lastname. For example, my name is Robs Muir, so my login name is rmuir. NOTE: sometimes more than just the first letter of your name is used in order to avoid giving out duplicate login names to people with the same last name and first initial. After typing in your login name, press return. The screen at this point should look like:
SunOS 5.7 login: rmuir Password:
At this point, you must enter your password. This password is initially assigned to you by the CUSD Computing Staff, but should be changed once you have logged in for the first time. Enter your password and press return. Note that what you type will not appear on the screen so that no one can find out your password simply by looking at your screen. After a brief wait, the system will go through the process of logging you in. Your screen will look like:
SunOS 5.7 login: rmuir Password: Last login: Fri Oct 27 11:41:20 from muir.cusd.clarem Sun Microsystems Inc. SunOS 5.7 Generic October 1998 Welcome to one of Claremont High School's Sun Microsystems' servers... a Sun Enterprise 250/296Mhz -- dual UltraSPARC-II running Solaris 7. UNAUTHORIZED ACCESS STRICTLY PROHIBITED. You have mail. Display set to Muir.CUSD.Claremont.Edu:0.0 [1:53pm] rmuir@CHS (~):
You are now logged in to CHS and can begin using the various features of the system. Let us start by analyzing the last line of your current screen:
[1:53pm] rmuir@CHS (~):This line is known as the prompt (sometimes referred to as the "% prompt"), and you will encounter it repeatedly while using a UNIX system. At the prompt, you can enter commands to be executed and launch programs. The first part of the prompt (chs:/usr/users/staff/rmuir) indicates the current directory or "folder" you are in on the system. We will go more into depth about directory and file structure later.. For now, we will discuss basic commands you can execute from the prompt.
NOTE: Unlike other operating systems, UNIX is CaSe SeNsItIvE! Usually, it easier to keep command and file names in all lower case to avoid confusion.
To execute a command, simply type it in at the prompt and type enter. For example, your screen would look like this when executing the passwd command (which is discussed below):
chs:/usr/users/staff/rmuir% passwd
The passwd command allows you to change your login password. Passwords should be made up of a combination of upper and lowercase letters, as well as non-alphanumeric characters. This makes it harder for someone to guess your password and break into CHS under your name. It is important that you keep your password secret in order to protect CHS, or any other system, from illegal intrusions. To execute a command, simply type it in at the prompt and type enter. For example, your screen would look like this when executing passwd:
chs:/usr/users/staff/rmuir% passwd Changing password for rmuir Old password:You would then proceed to enter your initial password, assigned when you received your new account. Thereafter, you will be prompted to provide your new choice for a password and then given a chance to confirm your new password by retyping it a second time.
When you're finished with your Unix session you should use the logout command to log your out from the CHS/CUSD cluster before quitting the telnet program.
logout
The less command allows you to display a text file on screen and move through it page by page. To display a file, simply type:
more filename.txtwhere filename.txt is the name of the file.
Finger is a powerful command that allows you to find out information about other users, including whether or not they are currently online. With finger, you can even check to see if users at remote sites exist and are available. To use finger, type:
finger username@sitewhere username is the person's login name and site is the address of the system they are on (e.g. chs.cusd.claremont.edu). Note that if they are on the same system as you are currently on, the @site portion can be left out.
who
The talk command allows you to communicate in real-time with other users both on the system you are currently on and also with most any remote system, provided the person you want to talk to is currently logged in. To use talk, type:
talk username@sitewhere username is the person's login name and site is the address of the system they are on (e.g. chs.cusd.claremont.edu). Note that if they are on the same system as you are currently on, the @site portion can be left out.
Pine is a powerful and easy to use program for managing your e-mail. It is the recommended e-mail program for new users. To start pine, simply type:
pineat the prompt, and follow pine's menus from there. Another, more advanced e-mail program known as elm is also available.
Pico is a simple, easy to use text editor that can be used to author simple documents. To run it, simply type:
picoat the prompt. A more advanced text editor that is also commonly used to write code for programs is emacs.
Elm is a relatively powerful e-mail program that allows you to manage your incoming and outgoing mail, as well as perform more advanced functions such as set up aliases for people's e-mail addresses. To run it, type:
elmAn easier to use e-mail program known as pine is recommended for new users.
Emacs is a powerful text editor and source code editor for the unix operating system. You will most likely use it in computer science courses for writing your code. To run emacs, type:
emacsIf you would simply like an easy to use basic text editing program, you can use pico.
The wc command returns the number of bytes, the number of whitespace-separated words, and the number of newlines in the specified file:
chs:/usr/users/staff/rmuir% wc filename.txt
467 2802 33651 filename.txt
The grep command is used to search for an pattern in a file. The pattern can be a simple keyword or a regular expression. Grep returns each line in the file that matches the pattern:
grep keyword filename
The apropos command allows you to look up commands that relate to a given topic. Simply type:
apropos topicwhere topic is the topic you are interested in.
The file structure in Unix is set up in a system of hierarchical directories, much like DOS. When you log in for the first time, you are in your own directory, which is a subdirectory of higher level directories. Your personal subdirectory also has an alias to it - the ~. This makes it easy to access your directory, since you only need to type the ~ instead of the full path name of your directory in order to access it. A path or path name is the list of all directories, starting with the root, or highest level directory, that leads to the directory in question. For example, a subdirectory to the root directory has the path /dirname, while a subdirectory to that directory has the path /dirname/dirname2, and so on. The following commands can be used to navigate the directories:
Both the ls and dir commands display the contents of the directory you are currently in. You can add switches to change the behavior of the command. For example, the -l switch will give you additional information about the files in the directory, including the file type, permissions, owner name, group name, size in bytes, and a timestamp:
ls -l
The mkdir command allows you to create a new directory. If you simply type:
mkdir dirnamethen you will have created a new subdirectory to the directory you are currently in, and its name will be dirname. If you give a path in addition to a dirname, you can specify exactly where to put the directory. For example, say the directory /temp already exists. You can create a subdirectory to temp named test by typing:
mkdir /temp/test
The rmdir command works much like the mkdir command (see above), except that it removes directories.
The cd, or change directory, command allows you to navigate the directories of the system. To go to a subdirectory of the directory you're currently in, simply type:
cd dirnamewhere dirname is the name of the subdirectory. To move up a directory, type:
cd ..To go to your home directory, use the ~ alias to it:
cd ~Finally, to move to a specific directory that you know the full path name of, simply type:
cd /path/dirname
The rm command allows you to remove files from the current directory or any other directory. To use it, type:
rm /path/filenamewhere path is the directory path to the file and filename is the name of the file. If the file is in the directory you are currently in then you can omit the path and simply type:
rm filename
The cp command is used to make a copy of a file or files. To use it simply type:
cp filename newfilenameif you want the new file to be located in the same directory as the original file. To copy it to a different directory or subdirectory type the command:
cp filename subdirectory/newfilename
To move a file to a different directory or subdirectory you use the mv command:
mv filename subdirectory/.The dot in
subdirectory/.simply indicates that you want the file to have the same name when you move it. mv can also be used to rename a file as follows:
mv filename newfilename
Wildcards are generic characters that can be used in place of specific parts of commands or file names you type in. The ? wildcard can be put in place of any character, and the * wildcard represents multiple characters. Wildcards are especially useful when you are trying to access a number of files. For example, say you wish to do something with a number of text files, all of which have the extension .txt. Instead of manipulating each one individually by typing in its filename, you can simply type *.txt. The operating system will interpret this as any file name that has .txt as its last four characters. Similarly, ?.txt is interpreted as any file that has one character in its name, followed by .txt.
You can set up aliases to commonly used commands in order to make them easier to access. For example, say you often type:
finger bob@nowhere.comInstead of typing this whole command out each time, you can set up an alias that does the same thing. Simply type:
alias aliasname finger bob@nowhere.comwhere aliasname is anything you want it to be. Note that aliasname should not be the same as a pre-defined unix command. Now, whenever you type aliasname, finger bob@nowhere.com will automatically be executed. You can set up aliases for any command you want; the general form is:
alias aliasname command
The output of one UNIX command can be redirected to a file by using the redirect command >. For example you can redirect the output of the ls command to a file so that you could print it or examine it later:
ls > filename.txt
The output of a UNIX command can also be piped as input to another UNIX command. This is done by using the pipe command |. For example, if you had a directory with a very large number of files you could pipe the results of the ls command to the more command:
ls | more
The man command can be used to look up information about a particular command, including syntax for using it. To find out a command, simply type:
man commandname
CHS/CUSD's Academic Computing department has a number of resources to aid you in using the CUSD's computing facilities. If you can't find the information you need in these web pages, you can try start by subscribing to one of our Majordomo automated lists. You could then post a more specific question to the net-support-l list.
Edited by Robs Muir, 1997 from text written by Zachary Benz, HMC '98
Revised: January 31, 2002 by Robs Muir
URL http://www.cusd.claremont.edu/computing/doc/unix/basics.html