Created
May 11, 2014 04:15
-
-
Save fatpixel/36895ef133e5723560ba to your computer and use it in GitHub Desktop.
This file contains hidden or 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
# .bash_profile | |
# Get the aliases and functions | |
if [ -f ~/.bashrc ]; then | |
. ~/.bashrc | |
fi | |
# User specific environment and startup programs | |
PATH=$PATH:$HOME/bin | |
export PATH | |
export EDITOR=nano | |
# Path output | |
alias path='echo -e ${PATH//:/\\n}' | |
## Jump back n directories shortcuts ## | |
# get rid of command not found # | |
alias cd..='cd ..' | |
# a quick way to get out of current directory ## | |
alias ..='cd ..' | |
alias ...='cd ../../../' | |
alias ....='cd ../../../../' | |
alias .....='cd ../../../../' | |
alias .4='cd ../../../../' | |
alias .5='cd ../../../../..' | |
# To get my external IP | |
alias myip="/sbin/ifconfig eth0 | sed '/inet\ /!d;s/.*r://g;s/\ .*//g'" | |
# To clear terminal | |
alias cs='clear' | |
# To exit terminal | |
alias e='exit' | |
# See http://www.shellperson.net/using-sudo-with-an-alias/ | |
alias sudo='sudo ' | |
# This alias reloads this file | |
alias reload_profile='. ~/.bash_profile' | |
# reboot / halt / poweroff | |
alias reboot='sudo /sbin/reboot' | |
alias poweroff='sudo /sbin/poweroff' | |
alias halt='sudo /sbin/halt' | |
alias shutdown='sudo /sbin/shutdown -h now' | |
# All other aliases | |
alias ls='ls -aFhlG' | |
alias ll='ls -l' | |
alias search=grep | |
alias ports='sudo lsof -iTCP -sTCP:LISTEN -P' | |
# Super user | |
alias _='sudo' | |
alias please='sudo' | |
# Show history | |
alias history='fc -l 1' | |
# List directory contents | |
alias lsa='ls -lah' | |
alias l='ls -la' | |
alias ll='ls -l' | |
alias la='ls -lA' | |
alias sl=ls # often screw this up | |
## Control firewall (iptables) output ## | |
# shortcut for iptables and pass it via sudo | |
alias ipt='sudo /sbin/iptables' | |
# display all rules # | |
alias iptlist='sudo /sbin/iptables -L -n -v --line-numbers' | |
alias iptlistin='sudo /sbin/iptables -L INPUT -n -v --line-numbers' | |
alias iptlistout='sudo /sbin/iptables -L OUTPUT -n -v --line-numbers' | |
alias iptlistfw='sudo /sbin/iptables -L FORWARD -n -v --line-numbers' | |
alias firewall=iptlist | |
## Start / Stop / Restart Services ## | |
# Nginx | |
alias nginx_st='service nginx start' | |
alias nginx_sp='service nginx stop' | |
alias nginx_rs='service nginx restart' | |
alias nginx_reload="nginx -tt && service nginx reload" | |
# MySQL | |
alias mysql_st='service mysql start' | |
alias mysql_sp='service mysql stop' | |
alias mysql_rs='service mysql restart' | |
# PHP | |
alias php_st='service php-fpm start' | |
alias php_sp='service php-fpm stop' | |
alias php_rs='service php-fpm restart' | |
# Memcached | |
alias memc_st='service memcached start' | |
alias memc_sp='service memcached stop' | |
alias memc_rs='service memcached restart' | |
# Cron Restart | |
alias cron_rs="/sbin/service crond restart" | |
## Go to Directory shortcuts ## | |
# Nginx directory | |
alias gt_nginx="cd /usr/local/nginx" | |
# Domains directory | |
alias gt_domains="cd /home/nginx/domains" | |
# Logs directory | |
alias gt_logs="cd /var/log" | |
## Execute Bash Files ## | |
# Show Centmin Mod Menu | |
alias centmin="cd /usr/local/src/centmin-v1.2.3mod; ./centmin.sh" | |
# Update CloudFlare IPs | |
alias cf_update="/usr/local/nginx/bash/cloudflare-ip-ranges-updater.sh" | |
# Update Google IPs | |
alias google_update="/usr/local/nginx/bash/google-ip-ranges-updater.sh" | |
## Debug web server / cdn problems with curl ## | |
# get web server headers # | |
alias header='curl -I' | |
# find out if remote server supports gzip / mod_deflate or not # | |
alias headerc='curl -I --compress' | |
## Distro specific RHEL/CentOS update ## | |
alias update='yum update' | |
alias updatey='yum -y update' | |
## Get system memory and cpu usage info quickly ## | |
# pass options to free | |
alias meminfo='free -m -l -t' | |
# get top process eating memory | |
alias psmem='ps auxf | sort -nr -k 4' | |
alias psmem10='ps auxf | sort -nr -k 4 | head -10' | |
# get top process eating cpu | |
alias pscpu='ps auxf | sort -nr -k 3' | |
alias pscpu10='ps auxf | sort -nr -k 3 | head -10' | |
# Get server cpu info | |
alias cpuinfo='lscpu' | |
# Quickly flush out memcached server ## | |
alias flushmcd='echo "flush_all" | nc 127.0.0.1 11211' | |
## Git Shortcuts! ## | |
alias g="git" | |
alias gr="git rm -rf" | |
alias gs="git status" | |
alias ga="g add" | |
alias gc="git commit -m" | |
alias gp="git push origin master" | |
alias gl="git pull origin master" | |
# Laravel Artisan Alias | |
alias art="php artisan" | |
# Work around for phar+apc bug | |
alias composer="php -d apc.enable_cli=0 /usr/local/bin/composer" | |
# Clear all files under log dir | |
alias clear_logs="find /var/log/ -maxdepth 2 -type f -exec cat /dev/null > {} \;" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment