Refactored aliases

This commit is contained in:
Anthony Axenov 2022-02-15 15:50:29 +08:00
parent baeb784264
commit 8e1157afc5
Signed by: anthony
GPG Key ID: EA9EC32FF7CCD4EC

View File

@ -1,51 +1,89 @@
# Common #!/bin/bash
own() {
sudo chmod 0664 -R --preserve-root $@ alias ..="cd .."
sudo chown $USER. -R --preserve-root $@ alias chmod="chmod --preserve-root"
} alias chown="chown --preserve-root"
#alias aliases='source ~/install/aliases && cat ~/install/aliases' alias free="free -h"
alias aliases='source ~/install/aliases' alias l='ls -CFph --color=auto'
alias zshrc='source ~/.zshrc' alias la='ls -Aph --color=auto'
alias wine='LANG=ru_RU.utf8 wine' alias ll='ls -alFph --color=auto'
alias upgrade='sudo apt update && sudo apt upgrade -y' alias mkdir="mkdir -pv"
alias ps="ps auxf"
alias psg="ps aux | grep -v grep | grep -i -e VSZ -e"
# alias where="whereis" # zsh builtin
alias duh='du -ha --max-depth=1' alias duh='du -ha --max-depth=1'
alias sduh='sudo du -ha --max-depth=1' alias sduh='sudo du -ha --max-depth=1'
alias ports='netstat -tulanp' alias wine='LANG=ru_RU.utf8 wine'
# Navigation # alias bashrc='source ~/.bashrc'
alias projects='cd ~/projects' alias zshrc='source ~/.zshrc'
alias Downloads='cd ~/Downloads' alias realias='source ~/.bash_aliases'
alias is="type -a"
alias upgrade='sudo apt update && sudo apt upgrade -y && sudo snap refresh'
alias untargz="tar xczf"
alias mkcd="mkdir -p $1 && cd $1"
alias cl="cd $1 && ll"
alias myip="curl http://ipecho.net/plain; echo"
alias gpg.keys='gpg --list-keys --keyid-format SHORT'
alias gpg.keys.sec='gpg --list-secret-keys --keyid-format SHORT'
alias ssh.key='cat ~/.ssh/id_rsa.pub'
alias ports='netstat -tulpan'
# apache2 # $1 -- file/dir path
alias a2ls='ls -al /etc/apache2/sites-available/' # $2 -- permissions (0644, 0755, etc)
alias a2slen='ls -al /etc/apache2/sites-enabled/' # own() { #TODO refactor
alias a2err='sudo tail /var/log/apache2/error_log' # [ "$1" ] && PATH="${1/#\~/$HOME}" || {
#alias a2errclr='sudo truncate -s0 "/var/log/apache2/error_log"' # echo "Error (1): path not provided"
alias a2restart='sudo systemctl restart apache2' # }
alias a2reload='sudo systemctl reload apache2' # echo $PATH
# nginx # [ "$2" ] && PERM="$2" || {
#alias nxls='ls -al /etc/nginx/sites-available/' # if [ -d $PATH ]; then
#alias nxlsen='ls -al /etc/nginx/sites-enabled/' # PERM="0755"
#alias nxerr='sudo tail /var/log/nginx/error.log' # elif [ -f $PATH ]; then
#alias nxerrclr='sudo truncate -s0 "/var/log/nginx/error.log"' # PERM="0644"
#alias nxrest='sudo systemctl restart nginx' # else
#alias nxreload='sudo systemctl reload nginx' # echo "Error (2): path not exists"
#alias nxensite='~/Scripts/web/nxensite.sh' # fi;
# }
# echo $PERM
# mysql # sudo chmod $PERM -R --preserve-root $PATH
alias mysqlstart='sudo systemctl start mysql' # sudo chown $USER. -R --preserve-root $PATH
alias mysqlstop='sudo systemctl stop mysql' # }
alias mysqlrestart='sudo systemctl restart mysql'
alias mysqlstatus='sudo systemctl status mysql'
# pgsql # function extract {
#alias psql='sudo -u postgres psql' # if [ -z "$1" ]; then
# # display usage if no parameters given
# php # echo "Usage: extract <path/file_name>.<zip|rar|bz2|gz|tar|tbz2|tgz|Z|7z|xz|ex|tar.bz2|tar.gz|tar.xz>"
alias phprestart='sudo systemctl restart php-fpm' # echo " extract <path/file_name_1.ext> [path/file_name_2.ext] [path/file_name_3.ext]"
# return 1
# Docker # else
alias dockerstart='sudo systemctl start docker' # for n in $@
alias dockerrestart='sudo systemctl restart docker' # do
alias dockerstop='sudo systemctl stop docker' # if [ -f "$n" ] ; then
# case "${n%,}" in
# *.tar.bz2|*.tar.gz|*.tar.xz|*.tbz2|*.tgz|*.txz|*.tar)
# tar xvf "$n" ;;
# *.lzma) unlzma ./"$n" ;;
# *.bz2) bunzip2 ./"$n" ;;
# *.rar) unrar x -ad ./"$n" ;;
# *.gz) gunzip ./"$n" ;;
# *.zip) unzip ./"$n" ;;
# *.z) uncompress ./"$n" ;;
# *.7z|*.arj|*.cab|*.chm|*.deb|*.dmg|*.iso|*.lzh|*.msi|*.rpm|*.udf|*.wim|*.xar)
# 7z x ./"$n" ;;
# *.xz) unxz ./"$n" ;;
# *.exe) cabextract ./"$n" ;;
# *)
# echo "extract: '$n' - unknown archive method"
# return 1
# ;;
# esac
# else
# echo "'$n' - file does not exist"
# return 1
# fi
# done
# fi
# }