Last active
May 13, 2021 18:40
-
-
Save vincejv/4b131ee42e2b7bb9503c0a8c1cf32a4e to your computer and use it in GitHub Desktop.
Bash Aliases
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# .bashrc - Aliases | |
# Custom shell prompt | |
export PS1="\[\033[38;5;11m\]\u\[$(tput sgr0)\]@\h\[$(tput sgr0)\]\[\033[38;5;6m\][\[$(tput sgr0)\]\[\033[38;5;39m\]\W\[$(tput sgr0)\]\[\033[38;5;6m\]]\[$(tput sgr0)\]\\$ \[$(tput sgr0)\]" | |
# Work with sudo | |
alias sudo='sudo ' | |
# User specific aliases and functions | |
# Modem Restart | |
alias modemr="nohup /opt/cron/modem/restart.sh > /dev/null 2>&1 &" | |
# Open certificates | |
alias cert="openssl x509 -noout -text -in" | |
# Restarting systemd services | |
alias reload="sudo systemctl restart" | |
# Stopping systemd services | |
alias stop="sudo systemctl stop" | |
# Status of systemd services | |
alias status="sudo systemctl status" | |
alias loads="sudo systemctl enable" | |
alias unloads="sudo systemctl disable" | |
alias checks="sudo systemctl is-enabled" | |
alias drload="sudo systemctl daemon-reload" | |
# Force unmount | |
alias umountf="sudo umount -lfat" | |
# Clear screen | |
alias cls="clear" | |
# Get process by name | |
alias psx="ps aux | grep" | |
# ls with numeric permissions | |
alias lsl="sudo ls -alha --color=always -F --group-directories-first | awk '{k=0;s=0;for(i=0;i<=8;i++){;k+=((substr(\$1,i+2,1)~/[rwxst]/)*2^(8-i));};j=4;for(i=4;i<=10;i+=3){;s+=((substr(\$1,i,1)~/[stST]/)*j);j/=2;};if(k){;printf(\"%0o%0o \",s,k);};print;}'" | |
# View logs of systemd services | |
alias slog="sudo journalctl -u" | |
# Touch that auto creates folders | |
atouch() { mkdir -p "$(dirname "$1")" && touch "$1" ; } | |
# Superuser Nano | |
alias nano="sudo nano" | |
# Quickly edit aliases | |
alias aliase="nano /home/vince/.aliasrc" | |
# Sudo alias | |
alias sd="sudo" | |
# Run command as another user 'runas %user% %command%' | |
runas() { sudo -u "$1" bash -c "'$2'"l } | |
# Auto completion | |
. /opt/apps/complete_alias | |
complete -F _complete_alias $( alias | perl -lne 'print "$1" if /^alias ([^=]*)=/' ) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment