Last active
February 7, 2021 23:18
-
-
Save rw3iss/0a17042c4ad22376537fee49b33a17a6 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
# Path shortcuts: | |
alias h='cd ~' | |
alias ~='cd ~' | |
alias ..='cd ..' | |
alias d='cd ~/Downloads' | |
alias s='cd ~/Sites' | |
# Servers: | |
alias 3k='ssh [email protected]' | |
alias rw='ssh [email protected]' | |
#Sites: | |
alias rw="cd ~/Sites/ryanweiss/ryanweiss.net/rw-preact" | |
alias p="cd ~/Sites/percepta/src" | |
alias b="cd ~/Sites/blobs" | |
#------------------------------------------------------------------------------- | |
# Misc system commands: | |
alias reload='exec $SHELL -l' # Reload the current shell (i.e. invoke as a login shell) | |
alias update='sudo apt update -y && sudo apt upgrade' # Update all package and upgrade system | |
alias inputs="pactl list short sources" # list audio inputs | |
alias rsaudio="pulseaudio -k && sudo alsa force-reload" # restart audio engine | |
alias size='du -sh .' # get size of current directory | |
#------------------------------------------------------------------------------- | |
# Grep for a string in a given folder: | |
_grep() { | |
string=$1 | |
folder="." | |
if [ -z "$2" ] | |
then | |
echo "No search directory given, using current directory." | |
else | |
folder=$2 | |
fi | |
printf "Looking for '$string' in $folder \n\n" | |
sudo /bin/grep -Rn --exclude-dir={/run} "$folder" -e "$string" | |
} | |
alias gr=_grep | |
#------------------------------------------------------------------------------- | |
# Find a file by name: | |
_find() { | |
string=$1 | |
folder="." | |
if [ -z "$2" ] | |
then | |
echo "No search directory given, using current directory." | |
else | |
folder=$2 | |
fi | |
printf "Looking for filename '$string' in $folder \n\n" | |
sudo /bin/find "$folder" -name "$string" -print | |
} | |
alias f=_find | |
#------------------------------------------------------------------------------- | |
# Tar/Untar a directory: | |
_tar() { | |
filename=$1 | |
if [ -z "$2" ] | |
then | |
echo "No output filename supplied, using '$1'" | |
else | |
filename=$2 | |
fi | |
/bin/tar cvfz $filename.tar.gz $1 | |
} | |
untar() { | |
/bin/tar xvfz $1 | |
} | |
alias tar=_tar | |
alias untar=untar | |
#------------------------------------------------------------------------------- | |
# Git commands: | |
git_commit_add() { | |
git add . | |
git commit -m '$1' | |
} | |
git_commit_push() { | |
branch='master' | |
if [ -z "$2" ] | |
then | |
echo "No branch supplied, using '$branch'." | |
else | |
branch=$2 | |
fi | |
git add . | |
git commit -m "$1" | |
git push origin $branch | |
} | |
alias gca=git_commit_add | |
alias gcp=git_commit_push | |
#------------------------------------------------------------------------------- | |
# Networking: | |
getPortProcesses() { | |
lsof -i ':'$1 | |
} | |
alias pp=getPortProcesses | |
#------------------------------------------------------------------------------- | |
# Applications: | |
#alias nordvpn connect to US: | |
alias nord="sudo nordvpn connect us5461" | |
alias norddc="sudo nordvpn disconnect" | |
# Django / Python | |
#alias python='python3' | |
alias dr='python manage.py runserver' | |
alias gph='git add . && git commit -m 'Latest' && git push heroku master' | |
# Mysql: | |
alias mysqlstart='sudo /etc/init.d/mysql start' | |
alias mysqlstop='sudo /etc/init.d/mysql stop' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment