Created
April 8, 2014 17:19
-
-
Save greyaperez/10158444 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
#!/bin/sh | |
# ALIASES | |
alias editbash='vim ~/.bashrc' | |
alias updatebash='source ~/.bashrc' | |
alias rm='rm -i' | |
alias cp='cp -i' | |
alias mv='mv -i' | |
alias shutdown='shutdown -P now' | |
function whereis (){ | |
find . -name "$1*"; | |
} | |
function search (){ | |
if [ $# -lt 2 ]; | |
then | |
egrep -roiI $1 . | sort | uniq | |
else | |
grep -roiI --include $2 $1 . | sort | uniq | |
fi | |
} | |
function whoisport (){ | |
lsof -Pni4 | grep LISTEN | grep $1 | |
} | |
function mysql-import (){ | |
if [ $# -lt 2 ]; | |
then | |
echo 'mysql-import {DB-NAME} {SQL-FILE}'; | |
else | |
mysql $1 < $2; | |
fi | |
} | |
function log (){ | |
if [ $# -lt 1 ]; | |
then | |
tail -f * | |
fi | |
if [ $# -gt 1 ]; | |
then | |
tail -f $1 | grep --line-buffered "$2" | |
else | |
tail -f $1 | |
fi | |
} | |
function tcout(){ | |
log $CATALINA_HOME/logs/catalina.out | |
} | |
function get-mod-time (){ | |
stat -c ‘%Y’ $1 | |
} | |
function backup-db (){ | |
sqlfile=$1-$(date "+ %m-%d-%y_%H:%M").sql | |
echo -e "\n DB User: \n" | |
read input_variable | |
dbuser=“$input_variable” | |
echo -e "\n DB Pass: \n" | |
read input_variable | |
dbpass=“$input_variable” | |
mysqldump -u $dbuser $dbpass $1 > $sqlfile | |
echo -e "\nBacked-up, \"Like a boss\" \n ============ \n -"$sqlfile"\n\n" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment