Last active
May 30, 2018 09:35
-
-
Save sagiavinash/b64c9587c7aac222a67aaae80640f0df to your computer and use it in GitHub Desktop.
my generic bash aliases
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
function search() { | |
grep -inr --exclude={vendor\.min\.js,build\.min\.js,build\.js} --exclude-dir={node_modules,dist-test,dist-server,dist-client,coverage} $1 * | |
} | |
function replace() { | |
grep -ilr --exclude-dir={node_modules,dist-test,dist-server,dist-client} "$1" * | xargs -I@ sed -i '' "s/$1/$2/g" @ | |
} | |
function searchf() { | |
find . -name "*$1*" | |
} | |
function searchd() { | |
find . -type d -name "$1" -print | |
} | |
function code () { | |
if [[ $# = 0 ]] | |
then | |
open -a "Visual Studio Code" | |
else | |
[[ $1 = /* ]] && F="$1" || F="$PWD/${1#./}" | |
open -a "Visual Studio Code" --args "$F" | |
fi | |
} | |
function who_port () { | |
if [[ $# -ne 1 ]] | |
then | |
echo "No port provided" | |
return 1 | |
fi | |
sudo lsof -i "tcp:$1" | |
if [[ $? -eq 1 ]] | |
then | |
echo "No processes running on port: $1" >&2 | |
return 1 | |
fi | |
} | |
alias als='vim ~/.bash_aliases' | |
alias sals='source ~/.bash_aliases' | |
alias venv='source env/bin/activate' | |
alias es_start='~/elasticsearch-2.4.1/bin/elasticsearch' | |
alias search=search | |
alias replace=replace | |
alias searchf=searchf | |
alias searchd=searchd | |
alias who_port=who_port | |
alias code=code |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment