Getting Started with UNIX What is UNIX? Boston University Information Services & Technology Course Number: 4000 Course Instructor: Kenny Burns Operating System Interface between a user and the computer hardware UNIX is to a workstation as DOS is to a PC AIX is a version of UNIX which runs on the ACS cluster (ACS1, ACS2, ACSRS1, etc.), IBM RS/6000 systems, Information Services & Technology s s primary computing platforms for academic use From ACS you can exchange electronic mail and data with other Internet sites Why use UNIX? Connecting to ACS Can support a large number of users, e.g. almost 50,000 accounts on ACS Provides access to many UNIX software packages and tools such as Interleaf, Mathematica,, SAS, etc. ACS can host your personal Web page You may need to use UNIX for some ACS account administration If you have your own computer and only want to use electronic mail and/or surf the Web, you probably don t need to use UNIX PuTTY is available for SSH connections on PCs in Information Technology computing labs PuTTY (PC) is available for download at www.bu.edu/tech/help/acs/software SSH is built into Mac OS X. X-Win32 The Host Menu X-Win32 is a PC-based X-Windows X emulator available in Information Services & Technology computing labs To run X-Win32 X on a lab PC first log into the PC and then double-click on the X-Win32 icon on the PC desktop X-Win32 is available for free download to members of the B.U. community at www.bu.edu/tech/help/acs/software ech/help/acs/software (Exact display may vary) Course 4000: Getting Started with UNIX Slides, August 25, 2009. Page 1
Entering the Username and Password The Kerberos Password (Note: The password will not be echoed to the screen) The primary safeguard for your account Case sensitive Must be ten to fifteen characters in length Must contain at least two changes in case Must contain at least one digit or punctuation character Cannot be a name or a word which appears in the dictionary You should not share your password with anyone The X-Windows X Environment Message of the Day (MOTD) Console Window Work Window Welcome to the ACS cluster: * ACS - an IBM RS/6000 F50 running 32-bit AIX 5.2.0 * ACS1 - an IBM RS/6000 F50 running 32-bit AIX 5.2.0 * ACS2 - an IBM RS/6000 F50 running 32-bit AIX 5.2.0 * ACS3 - an IBM RS/6000 43P running 32-bit AIX 4.3.3 * ACS4 - an IBM RS/6000 615 running 64-bit AIX 5.2.0 * ACS5 - an IBM RS/6000 43P running 32-bit AIX 4.3.3 * ACS6 - an IBM RS/6000 43P running 32-bit AIX 4.3.3 Type "clustat" to see the status of the ACS machines. Message of the Day text Notification of last login Setting terminal type Use of this machine is governed by the Boston University Conditions of Use and Policy on Computing Ethics; see www.bu.edu/computing/ethics or type "ethics" for details. Icon Manager MOTD Window See www.bu.edu/cc for an introduction to the ACS cluster as well as detailed information on many services and applications. Problems or questions? Send mail to "help". ------------------------------ System News ------------------------------- 1 unsuccessful login attempt since last login. Last unsuccessful login: Wed Aug 12 17:04:27 2009 on /dev/pts/65 from ACSRS1.BU.EDU Last login: Fri Aug 21 17:00:41 2009 on /dev/pts/24 from ACSRS3.BU.EDU TERM = (vt100) acs[tuta0]% Reading System Messages (msgs( msgs) Logging out of UNIX Public messages regarding system matters, e.g. new software, system downtime, etc. Not to be confused with reading your personal e-maile y Read message n Skip (flush) message q Postpone reading messages Messages longer than one screen are processed through the more program. Press space to see the next screen or type q to quit Type logout or exit or Ctrl-d Control sequences are typed by holding down the Ctrl key and pressing the second key In an X-Windows X connection, you must log out from the Console window in the upper left corner of your display Failure to properly log off the system may result in your account being compromised! Remember to log off a computing lab PC after exiting the X-Win32 program Course 4000: Getting Started with UNIX Slides, August 25, 2009. Page 2
Special UNIX Control Characters The UNIX File System / (root) Ctrl-s Ctrl-q Ctrl-u Ctrl-c Ctrl-l Interrupt (pause) output to the screen Resume output to the screen Delete text to the beginning of the line Interrupt or cancel a command Refresh the screen /u2/grad/fred (Home Directory) bin /u2/grad fred grad usr mary staff u2 /u2 fac myfile Other homework john business mary /u2/grad/fred/other/john project paper Absolute and Relative Path Names Directory Navigation Absolute Path Name Always begins with a / Fully and uniquely describes a point in the file system Relative Path Name Never begins with a / Describes a point in the file system relative to the current working directory pwd Display the name of the current working directory Change the current working directory.. Change the current working directory to the parent of the current directory Change the current working directory to the home directory Create a new directory cd directory cd.. cd mkdir directory rmdir directory Remove an empty directory ls ls a ls l ls F Examining Directory Contents List contents of the current working directory List all contents, including hidden dot files List contents in long format List contents, marking special files: A trailing / indicates a directory A trailing * indicates an executable file These markers are not part of the filename! Flags can be combined, e.g. ls -alf File Permissions - r w x r - x - - - File Type User Group Other r Read permission w Write (modify) permission x Execute permission - Permission Denied Course 4000: Getting Started with UNIX Slides, August 25, 2009. Page 3
Changing File Permissions Using the chmod Command Use the chmod command to change UNIX file permissions: u Change permissions for the owner g Change permissions for the group o Change permissions for other + Add a permission - Remove a permission r Read permission w Write permission x Execute permission Examples of using the chmod command: chmod o-rx filename (Remove read/execute permission for other) chmod u+rwx,go+rx filename (Add all for user, read/execute for group & other) (Note: no space after the comma!) chmod o+rx. (Add read/execute for other on current directory) Viewing Text (ASCII) Files Lab Exercise One less filename more filename Space Return View a text file, one page at a time Functions similar to less command Advance one screen Advance one line b Go back one screen q Quit Logging into ACS Using the File System Changing File Permissions Viewing Text Files Lab Exercise One Instructions Manipulating Files Connect to a machine in the ACS cluster. Type your tutorial login name at the login: login: prompt: login: tuta# (substitute the number on the front of your computer for #; don t t leave a space before the #) password: PASSWORD cp original-file new-file Make a copy of an existing file mv original-file new-file Move or rename an existing file On ACS, mv has been aliased to mv -i rm filename Remove (delete) a file rm i filename On ACS, rm rm r directory Interactive removal of a file rm -i Remove a directory and all of its contents rm has been aliased to rm Course 4000: Getting Started with UNIX Slides, August 25, 2009. Page 4
Some More Special Characters Printing Files TAB Fills in remaining characters after significant characters have been typed Cycle up through previous commands Cycle down (after using the up arrow) ~ References a home directory * Wildcard matches zero or more characters Pipe direct output to another application Treat filenames in quotes literally lpr filename lpr Pprinter filename Prints a file on the default printer Prints a file on a different printer www.bu.edu/myprint to After submitting a print job, visit www.bu.edu/myprint release the print job. To view a list of available printers visit www.bu.edu/tech/help/myprint Quotas Resources are limited and are shared by many people quota Displays disk quota and usage Quota usage may also be monitored on the Web at www.bu.edu/computing/myacs Mail quota usage is monitored via MyACS page Printer sheets may be monitored at www.bu.edu/myprint Emacs A Text Editor At the command prompt type: emacs filename Used to manipulate text in plain (ASCII) files You will lose your work if you start Emacs without specifying a filename and don t t explicitly save your work to a named file. To avoid this, always specify a filename to edit when starting Emacs. The Control and Meta Keys in Emacs Moving the Cursor in Emacs Used in conjunction with other keys to enter commands On most keyboards, the Meta key is the Escape (ESC) key C-x means hold down the Ctrl key and press x M-x means press and release the ESC key, then press x C-b or Backward C-f or Forward C-p or Previous line C-n or Next line C-a Beginning of the current line C-e End of the current line C-v Next screen M-v Previous screen M-< Top of file M-> Bottom of file Course 4000: Getting Started with UNIX Slides, August 25, 2009. Page 5
Using Emacs to Edit Text Saving Changes to a File in Emacs Inserting Text Deleting Text Position cursor and type Terminal backspace key Delete to end of line Undo changes C-k Delete to end of line C-x x u or C-_ C-g Cancel a command C-x x C-sC Save and continue editing Due to conflicts with the system s s interpretation of C-s as hold screen, on some terminals C-s has been remapped to C-\,, so the save and continue command on such terminals becomes C-x x C-\ C Exiting Emacs Help with Emacs C-x x C-cC Save and exit Emacs If changes have been made to the file since the last save, you will be asked if you want to save these changes. A notable exception: If you started Emacs without specifying a filename and haven t t saved your work to a named file, you will not be asked if you want to save changes and you will lose your work. To avoid this, always specify a filename when starting Emacs Emacs command list function: C-x x p Free handout: Getting Started with Emacs Online manual page: man emacs Emacs reference manuals and books Manual Pages Help Information on the Web man command apropos topic Read manual page about command List commands associated with topic General ACS help is available on the Web at: www.bu.edu/tech/help/acs Copies of many handouts are available at: www.bu.edu/t /tech/help/handouts Course 4000: Getting Started with UNIX Slides, August 25, 2009. Page 6
Getting Help in Person Getting Help Through E-mailE IT Help Center 533 Commonwealth Avenue 617/353-HELP (4357) IT Help Center @ Mugar Library Mugar Library, First Floor For UNIX help, send mail to help on most machines, e.g. help@acs.bu.edu for ACS support For PC and Mac help, send mail to ithelp@bu.edu Departmental Consultants Reference Books Department of Mathematics Timothy Kohl - MCS 235; 617/353-8203; tkohl@bu.edu Sargent College Barbara Passoff SAR 543; 617/353-0818; bpassoff@bu.edu Learning the UNIX Operating System (174 pages, O Reilly O & Associates, Inc.) UNIX in a Nutshell (906 pages, O Reilly O & Associates, Inc.) GNU Emacs Manual by Richard M. Stallman (644 pages, Free Software Foundation) Learning GNU Emacs (534 pages, O Reilly O & Associates, Inc.) Lab Exercise Two Getting Started with UNIX Manipulating Files Displaying Quotas Using Emacs Using Online Help Functions Please remember to log off and complete your evaluation Boston University Information Services & Technology Course Number: 4000 Course Instructor: Kenny Burns Thank you! Course 4000: Getting Started with UNIX Slides, August 25, 2009. Page 7