Last active
May 15, 2025 10:26
-
-
Save amoilanen/d4815716b0b96c81d131c08f50b7d9b4 to your computer and use it in GitHub Desktop.
.bashrc utilities
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/bash | |
free_port() { | |
kill -9 $(lsof -t -i:$1) | |
} | |
terminate() { | |
pids_to_kill=$(ps aux|grep $1|grep -v grep|grep -v terminate.sh |awk '{print $2}') | |
[[ ! -z $pids_to_kill ]] && kill -9 $pids_to_kill | |
} | |
count_loc() { | |
if [[ $# -ne 2 ]]; then | |
echo "Usage: count_loc <path> <extension>" | |
return 1 | |
fi | |
find "$1" -type f -name "*.$2" -exec cat {} + | wc -l | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment