dotfiles/.bash_aliases

101 lines
2.6 KiB
Bash
Raw Normal View History

2019-09-27 15:19:27 +00:00
# Local system administration
# Alias management
2019-09-27 15:19:27 +00:00
alias 'editalias'='vim ~/.bash_aliases && . ~/.bash_aliases'
2019-10-17 03:07:35 +00:00
alias 'otheralias'='vim ~/.other_aliases && . ~/.bash_aliases'
2019-10-17 02:41:30 +00:00
alias 'viewalias'='view ~/.bash_aliases'
alias 'refreshalias'='source ~/.bash_aliases'
# SSH management
2021-04-02 01:44:47 +00:00
alias 'fssh'='ssh-add && ssh -A'
2019-09-27 15:19:27 +00:00
alias 'editssh'='vim ~/.ssh/config'
2020-07-01 15:38:48 +00:00
# Edit hosts file
alias 'edithosts'='sudo vim /etc/hosts'
# System packages using apt
2019-11-04 15:24:29 +00:00
alias 'update'='sudo apt update'
2019-09-27 15:19:27 +00:00
alias 'upgrade'='sudo apt update && sudo apt upgrade'
alias 'install'='sudo apt update && sudo apt install'
alias 'remove'='sudo apt remove'
# Restart display manager
2019-09-27 15:19:27 +00:00
alias 'restartgui'='sudo service sddm restart'
# Power management
2019-10-17 02:41:30 +00:00
alias 'reboot'='sudo reboot'
alias 'shutdown'='sudo shutdown'
2019-09-27 15:19:27 +00:00
2020-11-14 00:28:15 +00:00
# Clean up df output
alias df='df -x squashfs -x tmpfs -x devtmpfs'
2019-09-27 15:19:27 +00:00
# Vagrant shortcuts
alias 'vdup'='vagrant destroy -f && vagrant up'
alias 'vpro'='vagrant provision'
alias 'vssh'='ssh-add && vagrant ssh -c "sudo -i"'
2019-09-27 15:19:27 +00:00
alias 'vup'='vagrant up'
2020-07-17 18:22:41 +00:00
alias 'vhalt'='vagrant halt'
2019-09-27 15:19:27 +00:00
# Change to project folder
alias 'sw'='cd /home/$USER/software && clear'
# Git shortcuts
alias 'gad'='git add . && git diff --cached'
2019-10-17 02:41:30 +00:00
alias 'gdiff'='git diff'
alias 'status'='git status'
alias 'pull'='git pull --rebase'
alias 'merge'='git merge --ff-only'
alias 'upstream'='git push --set-upstream origin'
2019-11-04 15:14:10 +00:00
alias 'push'='git push'
alias 'branch'='git branch'
alias 'list'='git branch -a'
alias 'unstage'='git reset HEAD'
alias 'discard'='git checkout --'
2019-10-17 02:41:30 +00:00
alias 'log'='git log'
2020-05-01 15:35:12 +00:00
alias 'logsig'='git log --show-signature'
2019-10-17 02:41:30 +00:00
alias 'checkout'='git checkout'
alias 'commit'='git commit -S'
alias 'tcommit'='git commit -m "testing"'
alias 'tamend'='git commit --amend --no-edit --date "`date -R`"'
2019-10-17 02:41:30 +00:00
alias 'amend'='git commit -S --amend'
alias 'amendnew'='git commit -S --amend --date "`date -R`"'
2019-12-16 22:29:36 +00:00
alias 'fetch'='git fetch'
alias 'stash'='git stash'
alias 'resetb'='git reset --hard @{u}'
alias 'signhist'='git rebase --exec "git commit -S --amend --no-edit -n"'
alias 'signhistnew'='git rebase --exec "git commit -S --amend --date '\''`date -R`'\'' --no-edit -n"'
function gd() {
git diff HEAD~$1
}
2019-09-27 15:19:27 +00:00
2020-04-22 15:52:50 +00:00
function rebase() {
git rebase -i HEAD~$1
}
2020-06-17 13:34:52 +00:00
function delcommit() {
git reset --hard HEAD~$1
}
# Docker shortcuts
function inspect() {
docker inspect "$1" | less
}
2019-09-27 15:19:27 +00:00
# Color shift
2019-10-17 02:41:30 +00:00
alias 'night'='redshift -P -O 2500'
2019-09-27 15:19:27 +00:00
alias 'day'='redshift -x'
# SOCKS proxy over SSH
alias 'socks'='screen -dm ssh -D 1337 -q -C -N'
2019-10-17 03:07:35 +00:00
2020-03-28 00:22:12 +00:00
# sshuttle proxy
#e.g. alias 'proxyhome'='proxy user hostdomain:22 192.168.1.0/24'
function proxy() {
screen -dm sshuttle -v -r $1@$2 -x $2 ${@:2}; screen -r;
}
if [ -f ~/.other_aliases ]; then
source ~/.other_aliases
fi