Skip to content

Instantly share code, notes, and snippets.

@rohjay
Last active May 11, 2023 15:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rohjay/8d401ca8188464100b19cb8158b2e636 to your computer and use it in GitHub Desktop.
Save rohjay/8d401ca8188464100b19cb8158b2e636 to your computer and use it in GitHub Desktop.
These are some aliases I've enjoyed over the years =]
# PS1 stuff...
reset=$(tput -Txterm sgr0)
color=$(tput -Txterm setaf 3)
altcolor=$(tput -Txterm setaf 2)
export PS1="\[$color\]\u\[$reset\]@\[$altcolor\]\h\[$reset\]::\w>"
## Quick nav
alias ..="cd ../"
alias ~="cd ~"
alias sites="cd /var/www"
alias src="cd ~/code"
alias dump='cd ~/tmp'
alias localhost="cd /var/www/localhost/"
alias xit="exit"
## git shortcuts
alias ss='git status'
alias s="git status"
alias a="git add"
alias c="git commit"
alias o="git checkout"
alias u="git checkout --"
alias p="git pull"
alias f="git fetch"
alias b="git branch"
alias d="git diff"
alias l="git log"
alias giti='git config core.fileMode false'
alias gsafe='git config --global --add safe.directory `pwd`'
alias rpush='git push rohjay main'
alias kpush='git push kneejerk main'
alias jpush='git push jj main'
# set some defaults for commands
alias ll='ls -la'
alias lll='ls -lahF'
alias wget='wget -c'
alias df='df -H'
alias du='du -ch'
alias dum='du -ch --max-depth=1'
# Helpers - goddamn, I'm a potty mouth.
alias aa='vim ~/.bash_aliases'
alias redo="source ~/.bash_aliases"
alias fuck='sudo $(history -p \!\!)'
alias fucking='sudo'
alias tt='./vendor/bin/phpunit'
alias hosts="sudo vim /etc/hosts"
alias ahosts="cd /etc/nginx/sites-available"
alias ehosts="cd /etc/nginx/sites-enabled/"
alias logs="cd /var/log/nginx/"
# This makes it so my greps are case insensitive, NOT regex, not binary files, recursive, and provide line numbers.
# Then we replace tabs with spaces for indentation so when I cut the line so it's no longer than 168 chars wide,
# it doesn't wrap to the next line. Adjust to taste =P
function grepper() {
grep -IirFn $@ | sed --expression="s/\t/ /g" | cut -b 1-168
}
# These are simply helpers for local webdev stuff - DO NOT RUN THESE ACROSS PUBLICLY SERVED FOLDERS!!!
alias webmod="sudo chmod -R 0775 ."
alias webown="sudo chown -R www-data:www-data ."
alias weball="webmod && webown"
# Because I'm VERY professional ;P
alias cusser="grep -Iirn --include \*.php --include \*.js 'fuck\|shit\|cock\|bitch\|asshole' ."
alias todo='grep --include="*.php" -A1 -IirnP "\/\/\s?TODO[:]?.*$" .'
alias grephp='grep --include \*.php -IirFn'
# For all the node projects where you can't remember what npm run commands are available...
# or are simply being too lazy to type out the whole style.scss command =P
alias scripts="sed -n -e '/scripts\"\: {/,/\}/ p' package.json"
alias sassy="sass ./sass/style.scss ./style.css"
alias sasser="sass ./sass/style.scss ./style.css -w"
alias sassing="sassy && sasser"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment