My blog has moved!

You should be automatically redirected in 6 seconds. If not, visit
http://www.mattdturner.com/wordpress
and update your bookmarks.

AdSense

Pages

Tuesday, April 19, 2011

Useful .cshrc Commands

Throughout the years of using the command line in both Linux and Mac, I have spent quite a bit of time modifying my .cshrc file to my liking. 

This is mainly just a list of some commands that I think are useful.

# Prompt - Displayed as “@:
set prompt="`whoami`@%B`hostname -s`%B:" #Custom Prompt settings

alias lsl 'ls -larth'
alias qstatme 'qstat -u mturner'
alias qsubm 'qsub -I -V -l walltime=08:00:00,nodes=1:ppn=24'
alias quota '/usr/bin/quota -s -u mturner'


The “lsl” alias should be self explanatory.
“qstatme” displays the current PBS queue for my username only.
“qsubm” will start an interactive PBS job, using 1 full node, and requesting 8 hours.
“quota” will display my quota

# set title
alias cwdcmd 'echo -n "\033]0;$cwd\007"'


“cwdcmd” will change the title of the terminal window to match the current working directory


# ignore files for autocompletion
set fignore=(.o .mod)


The fignore environment variable tells the command line to ignore files that end in ‘.o’ or ‘.mod’ when doing autocompletion.

Lastly, a few lines for those of us who frequently run interactive jobs in PBS


# automatically move to directory interactive job is started from
if ($?PBS_ENVIRONMENT == 1) then
         if ( $PBS_ENVIRONMENT == PBS_INTERACTIVE ) then
                cd $PBS_O_WORKDIR
                echo 'Beginning Job     : '$PBS_JOBID
                echo 'Running on        : '$HOST
                echo 'Current Directory : '$PBS_O_WORKDIR
                echo ' '
        endif
endif


This bit of code will detect if the user has submitted an interactive job. If so, it will change the user’s directory to the directory from which the job was submitted. It will then display the job ID, the host, and the current working directory.

0 comments:

Post a Comment