2014-02-14 03:07:08 +01:00
|
|
|
#
|
|
|
|
# ~/.bash_aliases
|
|
|
|
#
|
|
|
|
|
|
|
|
# ----------------------------------------------------------------------
|
|
|
|
# LS COLORS
|
|
|
|
# ----------------------------------------------------------------------
|
|
|
|
|
|
|
|
# we always pass these to ls(1)
|
|
|
|
LS_COMMON="-F --group-directories-first -h"
|
|
|
|
|
|
|
|
if [ "$UNAME" = Darwin ]; then
|
|
|
|
# check if you're using gnu core-utils then use --color
|
2018-02-25 13:04:37 +01:00
|
|
|
if [[ "$(which ls)" == "/opt/local/bin/ls" ]]; then
|
|
|
|
LS_COMMON="$LS_COMMON --color"
|
2015-07-02 12:00:12 +02:00
|
|
|
else
|
2018-02-25 13:04:37 +01:00
|
|
|
LS_COMMON="$LS_COMMON -G"
|
2015-07-02 12:00:12 +02:00
|
|
|
fi
|
2014-02-14 03:07:08 +01:00
|
|
|
elif [ "$UNAME" = Linux ]; then
|
|
|
|
LS_COMMON="$LS_COMMON --color"
|
|
|
|
fi
|
|
|
|
|
|
|
|
# setup the main ls alias if we've established common args
|
|
|
|
test -n "$LS_COMMON" &&
|
2018-02-25 13:04:37 +01:00
|
|
|
alias ls="command ls $LS_COMMON"
|
2014-02-14 03:07:08 +01:00
|
|
|
|
|
|
|
# these use the ls aliases above
|
|
|
|
alias ll="ls -l"
|
|
|
|
alias la="ll -a"
|
|
|
|
alias l.="ls -d .*"
|
|
|
|
alias lh='la -h'
|
|
|
|
|
|
|
|
# ----------------------------------------------------------------------
|
|
|
|
# ALL ALIASES
|
|
|
|
# ----------------------------------------------------------------------
|
|
|
|
|
|
|
|
if [ "$UNAME" = Linux ]; then
|
|
|
|
alias grep='grep --color=auto'
|
|
|
|
fi
|
|
|
|
|
|
|
|
alias vi='vim'
|
2017-05-22 10:50:35 +02:00
|
|
|
alias bim='vim'
|
2014-02-14 03:07:08 +01:00
|
|
|
|
|
|
|
# Mandatory aliases to confirm destructive operations
|
|
|
|
alias cp='cp -iv'
|
|
|
|
alias mv='mv -iv'
|
|
|
|
alias rm='rm -i'
|
|
|
|
|
|
|
|
# Fast cd op
|
|
|
|
alias ..='cd ..'
|
|
|
|
alias ...='cd ../..'
|
|
|
|
alias ....='cd ../../..'
|
|
|
|
alias .....='cd ../../../..'
|
|
|
|
alias ......='cd ../../../../..'
|
|
|
|
|
|
|
|
# Use most instead of less if available
|
|
|
|
[ -x /usr/bin/most ] && alias more='most' && alias less='most'
|
|
|
|
[ -x /usr/bin/htop ] && alias top='htop'
|
|
|
|
|
2015-02-27 13:19:22 +01:00
|
|
|
# read man with colors
|
2014-02-14 03:07:08 +01:00
|
|
|
man() {
|
2018-02-25 13:04:37 +01:00
|
|
|
env LESS_TERMCAP_mb=$'\E[01;31m' \
|
2015-02-27 13:19:22 +01:00
|
|
|
LESS_TERMCAP_md=$'\E[01;38;5;74m' \
|
|
|
|
LESS_TERMCAP_me=$'\E[0m' \
|
|
|
|
LESS_TERMCAP_se=$'\E[0m' \
|
|
|
|
LESS_TERMCAP_so=$'\E[38;5;246m' \
|
|
|
|
LESS_TERMCAP_ue=$'\E[0m' \
|
|
|
|
LESS_TERMCAP_us=$'\E[04;38;5;146m' \
|
|
|
|
man "$@"
|
2014-02-14 03:07:08 +01:00
|
|
|
}
|
|
|
|
|
2014-03-19 11:04:32 +01:00
|
|
|
# print a line as wide as the terminal
|
|
|
|
line() {
|
2015-07-02 11:59:26 +02:00
|
|
|
printf %${COLUMNS}s | tr " " "="
|
2014-03-19 11:04:32 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
# make a backup of a file
|
|
|
|
# https://github.com/grml/grml-etc-core/blob/master/etc/zsh/zshrc
|
|
|
|
cpold() {
|
|
|
|
cp -a "$1" "${1}_$(date --iso-8601=seconds)"
|
|
|
|
}
|
|
|
|
|
2014-02-14 03:07:08 +01:00
|
|
|
# personnal desktop aliases
|
|
|
|
alias ssha="ssh-add"
|
2017-10-05 10:56:13 +02:00
|
|
|
|
2021-06-30 16:46:22 +02:00
|
|
|
# Git aliases
|
|
|
|
alias cdroot='git rev-parse && cd ./$(git rev-parse --show-cdup)'
|
|
|
|
|
2020-05-08 17:32:05 +02:00
|
|
|
alias cdcontrol='~/repos/work/gitlab.uni.lu/Puppet/control-repo'
|
|
|
|
alias cdpuppet=' ~/repos/work/gitolite.hpc/puppet-repo'
|
2020-05-08 17:06:35 +02:00
|
|
|
alias cdstor=' ~/repos/work/gitolite.hpc/storage-repo'
|
|
|
|
alias cdsyso=' ~/repos/work/gitolite.hpc/sysadmins-repo'
|
2020-05-08 17:32:05 +02:00
|
|
|
alias cdsys=' ~/repos/work/gitlab.uni.lu/ULHPC/sysadmins'
|
|
|
|
alias cdwww=' ~/repos/work/gitlab.uni.lu/www/ulhpc'
|
|
|
|
alias cdtools=' ~/repos/work/gitlab.uni.lu/ULHPC/ulhpc-tools'
|
|
|
|
alias cddocs=' ~/repos/work/gitlab.uni.lu/ULHPC/documents'
|
|
|
|
alias cdfai=' ~/repos/work/gitlab.uni.lu/ULHPC/fai-repo'
|
|
|
|
alias cdslides=' ~/repos/work/gitlab.uni.lu/ULHPC/slides'
|
|
|
|
alias cdstat=' ~/repos/work/gitlab.uni.lu/ULHPC/statistics'
|
|
|
|
alias cdtut=' ~/repos/work/github.com/ULHPC/tutorials'
|
2017-10-05 10:56:13 +02:00
|
|
|
|
2020-10-02 15:44:26 +02:00
|
|
|
alias cdpass=' ~/repos/work/gitolite.hpc/passwords-repo'
|
|
|
|
|
|
|
|
export PASSWORD_STORE_DIR=~/repos/work/gitolite.hpc/passwords-repo
|
|
|
|
export PASSWORD_STORE_SIGNING_KEY=1A53FD6E09A44DBA7A9FD72B5D08BCDD4F156AD7
|
2014-02-14 03:07:08 +01:00
|
|
|
|
|
|
|
g5kpass() {
|
2015-06-22 16:48:38 +02:00
|
|
|
curdir="$(pwd)"
|
2020-05-08 17:32:05 +02:00
|
|
|
cd ~/repos/work/gitlab.inria.fr/grid5000/password5k
|
2014-02-14 03:07:08 +01:00
|
|
|
source .passrc && /usr/bin/pass $*
|
2015-06-22 16:48:38 +02:00
|
|
|
cd "$curdir"
|
2014-02-14 03:07:08 +01:00
|
|
|
}
|