Skip to content

Instantly share code, notes, and snippets.

@exaucae
Last active October 27, 2021 12:50
Show Gist options
  • Save exaucae/02aaf4a592a3d8b2597bca59446bb396 to your computer and use it in GitHub Desktop.
Save exaucae/02aaf4a592a3d8b2597bca59446bb396 to your computer and use it in GitHub Desktop.
scripting utils
Windows
=======
1. netstat -ano | findstr < Port Number >
Example: netstat -ano | findstr 8080
2. taskkill /F /PID < Process Id >
Example: taskkill /F /PID 25392
# dir of script
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )";
# parent dir
# or PARENT_DIRECTORY="${DIR%/*}"
PARENT_DIR="$(dirname "$(dirname "$(readlink -fm "$0")")")"
Ref:
- https://stackoverflow.com/questions/20196034/retrieve-parent-directory-of-script
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment