share/Scripts/bash_aliases

78 lines
2.2 KiB
Bash
Raw Normal View History

2023-09-13 04:12:29 +00:00
# ~/.bash_aliases
alias cd..='cd ..'
alias cp='rsync -vh --progress'
alias copy='rsync -avh --progress'
alias c='clear'
alias ..='cd ..'
alias lsa='ls -a'
alias rm='rm -i'
alias v='vim'
alias python='python3'
alias pip='pip3'
alias g++='g++ -std=c++11'
alias activate='source ./ENV/bin/activate'
alias port='sudo lsof -nP -iTCP -sTCP:LISTEN'
alias serve='python3 -m http.server'
#git
alias add='git add -A'
alias commit='git commit -m'
alias push='git push'
alias pull='git pull'
alias checkout='git checkout'
alias status='git status'
alias switch='git switch'
alias logcs='git log --oneline --graph --stat'
alias logc='git log --oneline --graph --shortstat'
alias log='git log --all --decorate --oneline --graph'
alias logs='git log --all --decorate --oneline --graph --stat'
alias fetch='git fetch'
#Docker
alias drestart='systemctl restart NetworkManager docker'
alias containers="docker container ls -a"
alias images="docker images"
alias dps="docker ps -a --format 'table {{.Names}}\t{{.Status}}\t{{.Size}}\t{{.Ports}}'"
alias dstat="docker stats --format 'table {{.Name}}\t{{.CPUPerc}}\t{{.MemUsage}}\t{{.MemPerc}}\t{{.NetIO}}\t{{.BlockIO}}\t{{.PIDs}}'"
#self define function for git add commit push
acp(){
add;
commit "$1";
push;
}
export LSCOLORS="gxfxcxdxbxegedabagacad"
export CLICOLOR=1
export TERM="xterm-256color"
PS1='\[\e[0;33m\]\u\[\e[0m\]@\[\e[0;32m\]\h\[\e[0m\]:\[\033[01;34m\]\w\[\033[00m\]$(git_info)\[\033[00m\]\n\[\033[1;31m\]\$ \[\033[00m\]'
# functions
function git_info {
ref=$(git symbolic-ref HEAD 2> /dev/null) || return;
# Check for uncommitted changes in the index
if ! $(git diff --quiet --ignore-submodules --cached); then
uc=" $(tput setaf 64)+"
fi
# Check for unstaged changes
if ! $(git diff-files --quiet --ignore-submodules --); then
us=" $(tput setaf 124)!"
fi
# Check for untracked files
if [ -n "$(git ls-files --others --exclude-standard)" ]; then
ut=" $(tput setaf 166)?"
fi
# Check for stashed files
if $(git rev-parse --verify refs/stash &>/dev/null); then
st=" $(tput setaf 136)$"
fi
echo " ($(tput bold)${ref#refs/heads/}$uc$us$ut$st$(tput sgr0)$(tput setaf 254))";
# echo "(${ref#refs/heads/})";
}