1
0
Fork 0
mirror of https://github.com/hcartiaux/dotfiles.git synced 2024-10-18 17:25:23 +02:00
dotfiles/bash/bash_aliases

113 lines
3.3 KiB
Bash
Raw Normal View History

#
# ~/.bash_aliases
#
# ----------------------------------------------------------------------
# LS COLORS
# ----------------------------------------------------------------------
# we always pass these to ls(1)
LS_COMMON="-F -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 --group-directories-first --color"
else
2018-02-25 13:04:37 +01:00
LS_COMMON="$LS_COMMON -G"
fi
elif [ "$UNAME" = Linux ]; then
LS_COMMON="$LS_COMMON --group-directories-first --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"
# 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'
# 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'
# read man with colors
man() {
2018-02-25 13:04:37 +01:00
env LESS_TERMCAP_mb=$'\E[01;31m' \
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-03-19 11:04:32 +01:00
# print a line as wide as the terminal
line() {
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)"
}
# 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)'
2024-05-03 00:37:32 +02:00
alias cdnbsdna=' cd ~/repos/perso/github.com/hcartiaux/ansible'
alias cdnbsdnt=' cd ~/repos/perso/github.com/hcartiaux/terraform'
alias cdpuppet=' cd ~/repos/work/gitlab.uni.lu/Puppet/control-repo'
alias cdslurm=' cd ~/repos/work/gitlab.uni.lu/ULHPC/slurm'
alias cdudocs=' cd ~/repos/work/github.com/ULHPC/ulhpc-docs'
alias cdtut=' cd ~/repos/work/github.com/ULHPC/tutorials'
alias cdansible='cd ~/repos/work/hpc-git.uni.lu/Ansible/control-repo'
alias cdsys=' cd ~/repos/work/hpc-git.uni.lu/ULHPC/sysadmins'
alias cdwiki=' cd ~/repos/work/hpc-git.uni.lu/ULHPC/sysadmins.wiki'
alias cdtools=' cd ~/repos/work/hpc-git.uni.lu/ULHPC/ulhpc-tools'
alias cddocs=' cd ~/repos/work/hpc-git.uni.lu/ULHPC/documents'
alias cdstor=' cd ~/repos/work/hpc-git.uni.lu/ULHPC/storage-repo'
alias cdpass=' cd ~/repos/work/hpc-git.uni.lu/ULHPC/passwords-repo'
alias cdwww=' cd ~/repos/work/gitlab.com/uniluxembourg/hpc/www/ulhpc-2.0'
2024-04-09 16:06:55 +02:00
export PASSWORD_STORE_DIR=~/repos/work/hpc-git.uni.lu/ULHPC/passwords-repo
2022-09-01 14:30:27 +02:00
export PASSWORD_STORE_SIGNING_KEY=62C5D78FE715CF7CA974B5AF37183CEF550DF40B
g5kpass() {
curdir="$(pwd)"
cd ~/repos/work/gitlab.inria.fr/grid5000/password5k
source .passrc && /usr/bin/pass $*
cd "$curdir"
}