-
Notifications
You must be signed in to change notification settings - Fork 5
/
bashrc
105 lines (73 loc) · 3.35 KB
/
bashrc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
# Great Practical Ideas for Computer Scientists
# Sample .bashrc file
# We provide a few (useful) aliases and scripts for you to get started:
### afsperms <arguments to fs sa> -- Recursively runs fs sa on a directory
### cc <arguments to gcc> -- Invokes gcc with the flags you will usually use
### valgrind-leak <arguments to valgrind> -- Invokes valgrind in the mode to show all leaks
### hidden <arguments to ls> -- Displays ONLY the hidden files
### killz <program name> -- Kills all programs with the given program name
### shell -- Displays the name of the shell being used
### get_cs_afs_access -- Sets up cross-realm authentication with CS.CMU.EDU so you can access files stored there.
# More features may be added later as thought of or requested.
# ----- guard against non-interactive logins ---------------------------------
[ -z "$PS1" ] && return
# ----- convenient alias and function definitions ----------------------------
# color support for ls and grep
alias grep='grep --color=auto'
if [[ `uname` = "Darwin" || `uname` = "FreeBSD" ]]; then
alias ls='ls -G'
else
alias ls='ls --color=auto'
fi
alias killz='killall -9 '
alias hidden='ls -d .*'
alias rm='rm -v'
alias cp='cp -v'
alias mv='mv -v'
alias shell='ps -p $$ -o comm='
alias sml='rlwrap sml'
alias math='rlwrap MathKernel'
alias coin='rlwrap coin'
alias cc='gcc -Wall -W -ansi -pedantic -O2 '
alias valgrind-leak='valgrind --leak-check=full --show-reachable=yes'
afsperms(){ find $1 -type d -exec fs sa {} $2 $3 \; ; }
get_cs_afs_access() {
# Script to give a user with an andrew.cmu.edu account access to cs.cmu.edu
# See https://www.cs.cmu.edu/~help/afs/cross_realm.html for information.
# Get tokens. This might create the user, but I'm not sure that that's
# reliable, so we'll also try to do pts createuser.
aklog cs.cmu.edu
pts createuser $(whoami)@ANDREW.CMU.EDU -cell cs.cmu.edu 2>&1 | grep -v "Entry for name already exists"
aklog cs.cmu.edu
echo "Be sure to add aklog cs.cmu.edu & to your ~/.bashrc"
}
# ----- shell settings and completion -------------------------------------
# Make .bash_history store more and not store duplicates
export HISTCONTROL=ignoreboth
export HISTSIZE=250000
export HISTFILESIZE=250000
# 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
# Enable programmable completion features
if [ -f /etc/bash_completion ]; then
. /etc/bash_completion
fi
bind "set completion-ignore-case on"
# Make less more friendly for non-text input files, see lesspipe(1)
[ -x /usr/bin/lesspipe.sh ] && export LESSOPEN="|/usr/bin/lesspipe.sh %s"
# Turn off the ability for other people to message your terminal using wall
mesg n
# ----- change the prompt ----------------------------------------------------
# It's really fun to customize your prompt.
# Give it a try! See man bash for help
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
# ----- GPI-specific configuration -------------------------------------------
source ~/.bashrc_gpi
# ----- Adding bins for CS Classes -------------------------------------------
# For C0, Coin, etc (15-122)
export PATH=$PATH:/afs/andrew/course/15/122/bin
# For smlnj, etc (15-150)
export PATH=$PATH:/afs/andrew/course/15/122/bin