about summary refs log tree commit diff stats
path: root/conf/skel/.bashrc
diff options
context:
space:
mode:
Diffstat (limited to 'conf/skel/.bashrc')
-rw-r--r--conf/skel/.bashrc57
1 files changed, 57 insertions, 0 deletions
diff --git a/conf/skel/.bashrc b/conf/skel/.bashrc
new file mode 100644
index 0000000..38f4b24
--- /dev/null
+++ b/conf/skel/.bashrc
@@ -0,0 +1,57 @@
+# If not running interactively, don't do anything
+case $- in
+	*i*) ;;
+	*) return;;
+esac
+
+
+# check the window size after each command and, if necessary,
+# update the values of LINES and COLUMNS.
+shopt -s checkwinsize
+
+
+# don't put duplicate lines or lines starting with space in the history.
+# See bash(1) for more options
+HISTCONTROL=ignoreboth
+
+# append to the history file, don't overwrite it
+shopt -s histappend
+
+# for setting history length see HISTSIZE and HISTFILESIZE in bash(1)
+HISTSIZE=1000
+HISTFILESIZE=2000
+
+alias tmux="tmux -2"
+
+alias rm='rm -i'
+#alias cp='cp -i'
+alias mv='mv -i'
+# Prevents accidentally clobbering files.
+alias mkdir='mkdir -p'
+
+alias h='history'
+alias j='jobs -l'
+alias which='type -a'
+alias ..='cd ..'
+
+# Generate a password
+genpasswd () {
+    local l=$1
+    [ "$l" == "" ] && l=20
+    tr -dc A-Za-z0-9_ < /dev/urandom | head -c ${l} | xargs
+}
+
+# Git graph log
+glog () {
+    git log --graph --abbrev-commit --decorate --date=relative --all
+}
+
+if [[ -z "$TMUX" ]] ;then
+    ID="`tmux ls | grep -vm1 attached | cut -d: -f1`" # get the id of a deattached session
+    if [[ -z "$ID" ]] ;then # if not available create a new one
+        tmux new-session
+    else
+        tmux attach-session -t "$ID" # if available attach to it
+    fi
+fi
+