PSU CHEM 408 - A Few Computer Exercises

Unformatted text preview:

CHEM 408 – Sp06 3/15/2006 1In-Class Assignment – A Few Computer Exercises Due: 3/15/06 This assignment is primarily designed get you started using your hammer account and help you begin learning some of the computer skills that will be needed in later assignments. _________________________________________________________________ 1. As a first exercise you will edit the “.bashrc” file in your home directory so that it includes the features necessary for running the programs we’ll use in the course. (This exercise assumes that you have the default .bashrc provided by the HPC group. If you already had a Linux account set up prior to this course, ask me about what changes are essential.) The .bashrc file is one of several files that the Linux operating system uses to configure your environment to your specific tastes and needs. The names of such files typically begin with a period and are invisible to the ls command unless you use the –a option. Issuing the command ls –a will show you all of the “hidden” files a directory. Begin by copying the original .bashrc file to a new name that identifies it as yours, for example “Maroncelli.bashrc”. The command for doing so is ‘cp .bashrc Maroncelli.bashrc’. The file that you have initially, which can be typed using the command ‘cat .bashrc’ should look something like this: # .bashrc # User specific aliases and functions # Source global definitions if [ -f /etc/bashrc ]; then . /etc/bashrc fi Edit this file using one of editors available on hammer (vi, vim, emacs, or nedit) so that it contains all of the important features in the example shown on the following page. (You can also copy the file to the local computer for editing, but it is more useful to learn a little about editing on hammer itself and I would prefer that you work in this fashion at least for this first assignment.) If you like computers, you should learn to use the vim editor. It is far from self-explanatory, but it is very handy for working with unix-based computers. There is a ½ hour tutorial that will help get you started, which can be run by executing the command “vimtutor”. You’ll also want to print out one of the quick reference cards from the course web (Worksheets&Stuff page) to have on hand. The commands needed to start up the various editors are: \vi filename (the “\” here is required to unalias vi which is aliased to vim by default) vim filename emacs filename /usr/X11R6/bin/nedit filename (the /usr/X11R6/bin is not in the default path) In editing this file, note that lines beginning with the symbol # are comments. They are inserted in my version for intelligibility, and you need not copy them verbatim. Note also that except for these comments, Linux commands are always case sensitive and are sometimes sensitive to proper separation of arguments (space or no space). This sensitivity often proves to be an annoyance for novice users.CHEM 408 – Sp06 3/15/2006 2#################################################################### # CHEM_408.bashrc - recommended .bashrc for use in CHEM 408 # mpm, 3/11/06 #################################################################### # Source global definitions if [ -f /etc/bashrc ]; then . /etc/bashrc . /etc/profile fi # export locations of important course-related programs export PATH=${PATH}:/usr/global/bin export GAUSS_SCRDIR="/tmp" # Set general "novice" default aliases alias rm='rm -i' alias mv='mv -i' alias cp='cp -i' # Apply user specific aliases and other functions if [ -f ~/.alias ]; then source ~/.alias fi #################################################################### _______________________________________________________________ Contents of this .bashrc: The first part of this .bashrc file sources two default configuration files (after testing for the existence of the 1st) which set various window properties, paths, and other environment variables. The line export PATH=${PATH}:/usr/global/bin adds /usr/global/bin to your “path”, which is the sequence of directories the operating system will search for a program to execute when you issue a command. Some of the programs the class will use are collected in this directory. The following line sets the scratch directory which will be used by the program Gaussian03 to write scratch files. The three lines beginning with the command ‘alias’ are used to prevent inadvertent deletion of files, by aliasing the three command so that they ask before removing (rm) or overwriting (cp, mv) existing files. (To illustrate their utility, suppose you wanted to remove some files from a directory that started with the string “junk” using the “*” wildcard. Without the –i flag on rm if you mistakenly type “rm junk *” instead of “rm junk*” linux would delete all of the files in the directory without asking.) Aliases provide a convenient means of selecting your favorite options to commands ( as with the -i above), to avoid constantly typing long commands, or as memory aids. For example, I like to use the aliases: alias ls='ls -F' use –F flag to distinguish between simple files, directories, and executable files when listing a directory alias 408='cd /home2/chem408' shortcut & memory aid to course directory The last portion of the .bashrc file checks in your home directory (represented by the “~” symbol) and if a file named “.alias”. If this file exists it will “source” the file, i.e. execute whatever commands it finds there. To make aliases for your use, simply create/edit a new file called “.alias” in your home directory and put in whatever aliases you find handy.CHEM 408 – Sp06 3/15/2006 3_______________________________________________________________ When you have finished editing the revised .bashrc file test to see if you have made any mistakes by executing the command: source your_name.bashrc If you have made no errors, the operating system will not say anything. If it responds there is one or more errors in the file. In the latter case, check it over thoroughly to see if you can find the error(s). When you are satisfied that the file is correct you can overwrite the original .bashrc file with this version using the cp command. Also put a copy of the appropriately named file into the directory /home2/chem408/student for my inspection and print copy of the file and turn it in as part of this


View Full Document

PSU CHEM 408 - A Few Computer Exercises

Documents in this Course
Load more
Download A Few Computer Exercises
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view A Few Computer Exercises and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view A Few Computer Exercises 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?