Dotfiles

From FarmShare

Revision as of 23:58, 30 September 2014 by Chekh (Talk | contribs)
Jump to: navigation, search

Contents

dotfiles

This page documents the shell setup files that are put in place for newly created accounts at Stanford. If you are a long time sunetid'er and would like to see the current "skeleton" files then keep reading. If you see some error when you login to farmshare and would like to compare to "pristine" .cshrc/.bashrc/.bash_profile/etc then keep reading.

The files below have been the default for new accounts since about Dec 2013, if your SUNetID is older than that, then your startup files may be an older version. Feel free to modify your local settings to suit your needs.

Also starting Dec 2013, we started provisioning accounts with bash as the default shell instead of tcsh. That change was long overdue:

moving old dotfiles

It's easy to move old startup files aside, just try something like

 mv .cshrc old.cshrc
 mv .profile old.profile

tcsh

.cshrc:

#------------#
# csh/tcsh   #
#------------#

umask 077   # file protection no read or write for others
            # umask 022 is no write but read for others

# Exit if non-interactive to avoid exposing aliases to scripts and
# to avoid problems caused by any local changes that produce output.
if (! $?prompt) exit

# Everything below this point only applies to interactive shells.
limit coredumpsize 0    # don't write core dumps
set noclobber           # don't overwrite existing file w/ redirect
set rmstar              # prompt before executing rm *
alias cp 'cp -i'        # prompt before overwriting file
alias mv 'mv -i'        # prompt before overwriting file
alias rm 'rm -i'        # prompt before removing file
set history=5000        # number of history commands to save

# Some programs honor VISUAL, so set this if EDITOR is set.
if ( $?EDITOR ) then
   setenv VISUAL "$EDITOR"
endif

set prompt="%m:%~%# "    # set prompt

# Put any local aliases or settings below this line.

.login:

# In this file, put any commands that you want to run on every login
# that might produce output.  Don't put any commands that produce
# output into .cshrc, since that will confuse non-interactive shells.


bash

.bashrc:

#------------#
#   bash     #
#------------#

umask 077   # file protection no read or write for others
            # umask 022 is no write but read for others

# append to the history file, don't overwrite it
shopt -s histappend

# check the window size after each command and, if necessary,
# update the values of LINES and COLUMNS.
shopt -s checkwinsize
ulimit -c 0
set -o noclobber
alias cp='cp -i'    # prompt before overwriting file
alias mv='mv -i'    # prompt before overwriting file
alias rm='rm -i'    # prompt before removing file

# enable bash completion in interactive shells
if [ -f /etc/bash_completion ] ; then
   . /etc/bash_completion
fi

# fancy prompt
case "$TERM" in
   xterm*)
     PSSUF='\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
     PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PSSUF"
    ;;
   *)
    PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
    ;;
esac

# Put any local aliases or settings below this line.

.bash_profile:

# give ^R some data to work with
export HISTSIZE=5000

# Some programs honor VISUAL, so set this if EDITOR is set.
if [ ! -z "$EDITOR" ] ; then
   export VISUAL=$EDITOR
fi

if [ -f $HOME/.bashrc ] ; then
  . $HOME/.bashrc
fi


zsh

.zshrc:

umask 077   # file protection no read or write for others
            # umask 022 is no write but read for others

ulimit -c 0
unsetopt CLOBBER    # don't overwrite existing file w/ redirect
alias cp='cp -i'    # prompt before overwriting file
alias mv='mv -i'    # prompt before overwriting file
alias rm='rm -i'    # prompt before removing file

setopt INC_APPEND_HISTORY    # set history options
setopt SHARE_HISTORY
setopt HIST_EXPIRE_DUPS_FIRST
setopt HIST_IGNORE_DUPS
setopt HIST_IGNORE_ALL_DUPS
setopt HIST_FIND_NO_DUPS
setopt HIST_SAVE_NO_DUPS

HISTFILE=$HOME/.zhistory     # set history file
HISTSIZE=5000                # number of history commands to save
SAVEHIST=$HISTSIZE

# Some programs honor VISUAL, so set this if EDITOR is set.
if [ ! -z "$EDITOR" ] ; then
   export VISUAL=$EDITOR
fi

autoload -Uz promptinit    # use prompt themes
promptinit

# basic prompt
prompt oliver
# you can run prompt -p to preview alternatives

# Put any local aliases or settings below this line.
Personal tools
Toolbox
LANGUAGES