Skip to content

Instantly share code, notes, and snippets.

@jiimaho
Last active October 14, 2023 16:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jiimaho/3a431022b2bb657adc58833b710f963a to your computer and use it in GitHub Desktop.
Save jiimaho/3a431022b2bb657adc58833b710f963a to your computer and use it in GitHub Desktop.
List process listening on port
# Below content is in .zshrc file normally under ~/.zshrc
# Do NOT replace your entire .zshrc with this content, but rather pick the pieces and APPEND to your existing .zshrc
# DOTNET
alias dri="dotnet restore --interactive"
alias db="dotnet build"
# K8S
# Usage: kx <context>
kx() {
kubectl config use-context $1
}
alias k=kubectl
[[ $commands[kubectl] ]] && source <(kubectl completion zsh)
# SUBLIME
export EDITOR="/Applications/Sublime\ Text.app/Contents/SharedSupport/bin/subl"
# LAZYGIT
# Usage: lg
lg()
{
export LAZYGIT_NEW_DIR_FILE=~/.lazygit/newdir
lazygit "$@"
if [ -f $LAZYGIT_NEW_DIR_FILE ]; then
cd "$(cat $LAZYGIT_NEW_DIR_FILE)"
rm -f $LAZYGIT_NEW_DIR_FILE > /dev/null
fi
}
# LAZYDOCKER
alias ld=lazydocker
# NETWORKING
# Usage: listening <PORT>
listening() {
if [ $# -eq 0 ]; then
lsof -iTCP -sTCP:LISTEN -n -P
elif [ $# -eq 1 ]; then
lsof -iTCP -sTCP:LISTEN -n -P | grep -i --color $1
else
echo "Usage: listening [pattern]"
fi
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment