# ~/.bash_aliases ################## ## Bash Aliases ## ################## # Originally created by Michael Kubler ( @kublermdk ) # Check out http://www.kublermdk.com/2017/01/18/my-bash_aliases/ for more information. alias timezone_new='sudo dpkg-reconfigure tzdata' alias aRestart='sudo apache2ctl -k graceful' alias acs='apt-cache search' alias agg='sudo apt-get upgrade' alias agi='sudo apt-get install' alias agr='sudo apt-get remove' alias agu='sudo apt-get update' alias aliasd='nano ~/.bash_aliases_local; source ~/.bash_aliases_local' alias aliasd_base='nano ~/.bash_aliases; source ~/.bash_aliases' alias aps='sudo dpkg --get-selections' alias apt='sudo apt-get install' alias a2r='sudo service apache2 reload' alias a2rr='sudo service apache2 restart' alias bashrc='nano ~/.bashrc; source ~/.bashrc' alias cdetca='cd /etc/apache2/sites-available' alias cdwww='cd /var/www/' alias chownWWW='sudo chown -Rc www-data:www-data * .ht*' alias da='sudo du -hsc *' alias das='du -cks * 2>/dev/null | sort -rn | while read size fname; do for unit in k M G T P E Z Y; do if [ $size -lt 1024 ]; then echo -e "${size}${unit}\t${fname}"; break; fi; size=$((size/1024)); done; done;' alias dir='ls --color=auto --format=vertical' alias directoryExec='sudo find * -type d -exec chmod -c ug+x {} \;' alias directoryRWX='find * -type d -exec chmod -c ug+rwx {} \;' alias ds='du -hsc * | sort -n' alias egrep='egrep --color=auto' alias eximQ='sudo exim -bp' alias eximRouting='exim -bt' alias eximHeaderOfMessage='exim -Mvh ' alias eximBodyOfMessage='exim -Mvb ' alias fgrep='fgrep --color=auto' alias grep='grep --color=auto' alias l='ls -CF' alias la='ls -A --color=auto' alias ll='ls -Alsch --color=auto' alias lll='ls -alsch --color=auto' alias load='uptime' alias logs='find /var/log/ -name "*.log" -type f -exec tail -n 1 -f {} +' alias logsErrors='find /var/log/ -name "error.log" -type f -exec tail -f {} +' alias logsudo='sudo find /var/log/ -name "*.log" -type f -exec sudo tail -f {} +' alias ls='ls --color=auto' alias maillog='tail -n 50 -f /var/log/exim4/mainlog /var/log/exim4/rejectlog' alias mailstats='eximstats /var/log/exim4/mainlog' alias mem='free -m' alias netstats='sudo netstat -tulpn' alias openz='gzip -d -c' alias rm='rm -v' alias rma='rm -Rv' alias screenDetach='echo Press [ctrl]+ a, d to detach. Screen -list to view and screen -r to reattach' alias rsnapshot-configtest='rsnapshot configtest' alias ubuntuVersion='cat /etc/*-release' alias vdir='ls --color=auto --format=long' alias fileperms='chmod ug+rw -Rc /var/www/; chown www-data:www-data -Rc /var/www/; find /var/www/ -type d -exec chmod -c ug+rwx {} \;' alias netGraph='slurm -i eth0' alias ifconfigNet='curl checkip.amazonaws.com' alias ifconfigNetAll='curl ifconfig.me/all' alias git_changed_files_from_commit_hash='git show --pretty="format:" --name-only '; # head is a good argument, otherwise the SHA1. Based on http://stackoverflow.com/questions/424071/list-all-the-files-for-a-commit-in-git alias git_changed_files_from_last_commit='git show --pretty="format:" --name-status head'; alias git_time='git log --since=1.day --pretty=format:"%Cblue%ar%Cgreen %s%Creset"' alias git_today='git log --since=1.day --pretty=format:"%Cgreen%s%Creset"' alias gitt='git log --since=1.day --pretty=format:"%Cblue%ar%Cgreen %s%Creset" | sed -e "s/^\([^\*]*\)//g" | sed -e "s/ \* /\n* /g"; echo ""' alias gittt='git log --since=1.day --pretty=format:"%Cblue%ar%Cgreen %s%Creset" | sed -e "s/ \* /\n* /g"; echo ""' alias gac='time git add --all . && time git commit' alias gacm='time git add --all . && time git commit -m "** A general commit update"' alias gacpp='git pull; git add . && git commit ; git push' alias chmod='chmod -c' alias chown='chown -c' alias rm='rm -v' alias mv='mv -v' alias cp='cp -v' # Remove all files, including .htaccess in the folder. alias rma='rm -rf {,.[!.],..?}*' alias removeALLFilesInThisFolder='time find -mindepth 1 -maxdepth 1 -print0 | xargs -0 rm -rf' alias ssh-config='nano ~/.ssh/config' alias setupLocales='echo "Locale was : " && cat /etc/default/locale && echo "Setting Locale to en_US.UTF-8" && export LANGUAGE=en_US.UTF-8 && export LANG=en_US.UTF-8 && export LC_ALL=en_US.UTF-8 && locale-gen en_US.UTF-8 && sudo apt-get -y install language-pack-en-base && sudo dpkg-reconfigure locales && echo "-- The locale is now : " && locale && echo " === Finished configuring Locales ==="' alias aws-describe='aws ec2 describe-instances' alias instance-id='curl -s http://instance-data/latest/meta-data/instance-id' # LS_COLORS (make directories purple instead of dark blue . The rest are what ubuntu shipped w/by default) LS_COLORS='no=00:fi=00:di=01;35:ln=01;36:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:su=37;41:sg=30;43:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arj=01;31:*.taz=01;31:*.lzh=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.gz=01;31:*.bz2=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.jpg=01;35:*.jpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.avi=01;35:*.fli=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.flac=01;35:*.mp3=01;35:*.mpc=01;35:*.ogg=01;35:*.wav=01;35:'; export LS_COLORS ## MDKs custom function for quickly looking up info about a site. It's not perfect but is useful. Example usage : # > diglookup kublermdk.com function diglookup { if [ -z "$1" ]; then # Then there was no argument passed to the function echo -n "* Please enter the domain name (e.g 'greyphoenix.biz' or 'filmsonthefly.com') : " read DOMAIN if [ "$DOMAIN" == "" ]; then # No answer to the question (User just pressed space, or timed out) echo "[ERROR] No domain listed. Now exiting" exit 2 else echo "- Domain set to $DOMAIN, doing the whois and DNS lookups" fi # End checking for user input else DOMAIN="${1}" fi echo "============================" echo "=== ${DOMAIN} ===" echo "============================" echo `date` echo "--- dig ${DOMAIN}" dig +short ${DOMAIN} echo "" echo "--- dig www.${DOMAIN}" dig +short www.${DOMAIN} echo "" echo "--- dig ${DOMAIN} mx" dig +short ${DOMAIN} mx echo "" echo "--- dig ${DOMAIN} txt" dig +short ${DOMAIN} txt echo "" echo "--- dig mail.${DOMAIN}" dig +short mail.${DOMAIN} echo "" echo "--- whois ${DOMAIN}" whois ${DOMAIN} echo "" DOMAIN_A_IP=`dig +short ${DOMAIN}` echo "--- Web server's reverse IP 'nslookup ${DOMAIN_A_IP}'" echo "" dig +short -x ${DOMAIN_A_IP} echo "" nslookup ${DOMAIN_A_IP} echo "---======---" } # As per https://getcomposer.org/doc/articles/troubleshooting.md#xdebug-impact-on-composer xdebug has been disabled on the CLI, but here we enabled it as needed #alias php='php -dzend_extension=xdebug.so' #alias phpunit='php $(which phpunit)' ## Include local changes (mainly because this ~/.bash_aliases file is managed by Ansible on some servers) source ~/.bash_aliases_local # When logging in, automatically change into the appropriate directory if [ -d "/var/www/" ]; then cd /var/www/ fi