Using the Suns Logging On In order to use the workstations in MCEC 356, you will need an account, which gives you permission to use the machines. You will be provided with the name of your account (such as mspezial) and an initial password. For each computing session, you will need to log onto the computer (referred to as login) in which you must provide the computer with your account name and password. The window which prompts the user for this information is displayed as the default, so it will be displayed on the screen when you sit down to the computer. When you have successfully logged in (by providing a correct account name and password) two windows will appear on the screen and you can begin working on the system. When you have completed this session you must logout. If you do not logout, another person can simply sit at the same machine and use your account and access all the information that is contained in it. It should be noted that you do not need to physically sit at a workstation in order to use it. The machines can be accessed via telnet as well, which allows you to "remotely" log onto and use the computing power of the machines. Unix Windows The Sun machines run an operating system called Solaris, which is Unix based. Therefore, to use the workstations, you will need to gain familiarity with some of the basic Unix operating system commands. Although a window interface to the operating system is provided, many of the actions that you will need to take must be entered textually, rather than by pointing, clicking and dragging, as is done on the Macs. On the Suns, the windows essentially represent miniature terminal screens. Since the Mac provides one terminal screen (that is, you can only be actively doing one thing at a time), the main menu bar appears at the top of the screen. However, since the windows on the Suns represent miniature screens, each window has its own menu associated with it. A window's menu is not visible constantly. Rather, it is accessed by clicking on the top portion of a window with the RIGHT mouse button. The menu only effects its own window. The menu enables the window to be resized, closed, quit etc. It can be accessed by moving the cursor to the top of the window (which will cause an arrow to be displayed) and depressing the right mouse button. On the Macs "system commands", which include directives that enable the user to manipulate files as a whole (ex. print, remove etc.) can be accessed by clicking menu buttons. In Unix, system commands are mainly entered textually by typing them from within a window. As a result, using these commands involves memorizing (or at least having a reference to) them. Graphical representations for elements (files, folders etc) are also not present. But one should be aware that all the icons on the Macs are simply graphical representations of physical elements which exist in the computer system. In Unix, you will use text to access and manipulate those elements. Thus, for example, Unix directories are simply Mac "folders", thus a directory holds a group of files. If a user types the command which displays the files in a directory, those files will be listed textually. There are a variety of window types available. You will want to use the xterm window, which appears automatically on the upper left of the screen when you login. An xterm window runs a program called the "shell" which simply reads and executes the Unix system commands you enter. The shell indicates that it is ready to read another command by printing a system prompt, which consists of the machine name, your login name and a '$'. The mouse cursor must be moved into which ever window you wish to access before commands can be entered. It is necessary to place the cursor into the appropriate window in order to indicate to the computer which window is currently active, that is which window your typed commands should effect. It should be noted that you may open multiple xterm windows. To open a new xterm window, move the cursor onto the background and depress the right mouse button. This will cause a system menu to appear. Select the xterm option. You can switch between using various xterm windows by moving the cursor. The Unix File System On a Mac files are typically stored either on the hard disk or on a diskette. However, on the Unix configuration used by the Suns, all files are stored at a central location. Your account, and all the files and directories you create, will become a part of the central file system. A Unix file system is configured as a single tree. The top of the tree, called the root directory, is specified by the name / . Each user has a home directory associated with their login name. You may move around the file system, from directory to directory. The last directory you have moved to, and therefore the directory which is currently defining your view of the file system, is called your current working directory. For example, if you type the Unix command ls, it will cause the names of all the files in your current working directory to be listed to the screen. When you login, your current working directory will automatically be set to your home directory. A file or directory may be specified in one of two ways. First, it can be specified using its absolute path name (sometimes called full path name), which means that the name specifies the complete path from the root of the file system to the file or directory. Thus, all absolute path names start with the name of the root directory, /. Each directory along that path is also delineated by a '/'. For example, the root directory has a subdirectory named home, which contains the home login directories of every user with an account on the suns. My account, mspezial, is a subdirectory of home. Assume that I have a file in my directory named notes. The absolute path name of notes is /home/mspezial/notes A file/directory can also be referred to by a relative path name, that is, relative to its position with respect to the current working directory. For example, if my current working directory were my home directory, I could simply refer to the file notes with its name (ie. notes). If my current working directory were the directory home, I could refer to notes with the name mspezial/notes. Some Useful Unix Commands Unix commands can only be entered when a system prompt (which typically ends in a $) is displayed. Unix commands come in a variety of flavors. Some commands require parameters, others do not. Also some commands have a number of variations or enhancements available, which can be accessed by using flags. A flag is a character which is preceded by a minus sign. The following are some useful Unix system commands: passwd enables you to change your password. You should change your password the first time you log on. ls list all the files in the current working directory ls -l list all files in the current working directory with some additional descriptive information. rm filename remove file filename lpr filename print file filename to the default printer cat filename print file filename to the screen cat filnm1 > filnm2 copy filnm1 onto filnm2, destroying previous contents of filnm2 cat filnm1 >> filnm2 append filnm1 to the end of filnm2 mkdir dirname create a new directory named dirname in the current working directory, making dirname a subdirectory of the current working directory cd change to the home (login) directory cd .. change to the directory above the current directory cd dirname change to directory dirname, making dirname the current working directory. dirname may simply be the name of a directory, in which case dirname must be listed in (ie. A subdirectory of) the current working directory. Alternatively, dirname may be an absolute path name. pwd print the absolute path name for the current working directory. ps list all user's actively running processes with process name and id number. kill -9 procid kill the process whose id is procid (obtained from ps) control-c kill the currently executing process man unixcommand print the manual page describing unixcommand to the screen vi filename start the vi editor using file filename if on exists File Protection On the workstations, all files are kept at a single site, which can be accessed by all users. Thus, you must make sure that your files are properly protected to prevent another user from accessing them. In Unix each file/directory has a 9 bit protection code associated with it. If you created a file, you become the file's "owner". This allows you to set/change a file's protection. The 9 protection bits are grouped into 3 sets of 3 bits, the first three bits define the file owner's access, the second 3 define a user group's access and the last 3 define the world access. Each set of bits, contains 3 bits, which define (yes/no) if read access, write access and execution access are permitted. The protection can be set in a number of ways, one of which is by using the chmod command: chmod accesscode filename or directoryname The access code is entered as a 3 digit number which is translated to a binary bit pattern which is then used to set the protection fields. Thus the command: chmod 700 filef will set the protection on filef to the bit pattern 111 000 000, which means the owner can read, write and execute the file, but there is no group or world access to the file. The default on the suns allows read access to everyone, so after you have created a file, be sure to use the chmod command to change its protection to 700. Logging Out You must explicitly log off the system, or else the next person who uses the machine will be able to use your account. To do this, move the cursor onto the background and depress the right mouse button. This will cause a system menu to appear. Select the EXIT option and confirm your choice. This will cause you to be logged off the system. To be sure that you have properly logged off, be sure that the login window reappears on the screen. If you are remotely logged in, you should simply type "logout".