diff options
author | ZachIR <zachir@librem.one> | 2025-08-14 14:00:49 -0500 |
---|---|---|
committer | ZachIR <zachir@librem.one> | 2025-08-14 14:00:49 -0500 |
commit | 73d7053762e737ac7176daa501fad40936a38813 (patch) | |
tree | 80ad128f4f700fb48916827fd185980335e4eb31 | |
parent | b9aff0bf540c789193f0aef407c07d5d4224fa97 (diff) |
-rwxr-xr-x | portprocess | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/portprocess b/portprocess new file mode 100755 index 0000000..f422ed7 --- /dev/null +++ b/portprocess @@ -0,0 +1,14 @@ +#!/bin/sh + +error () { + printf "%s\n" "$@" + exit 1 +} + +[ -z "$1" ] && error "Please provide a port to check!" + +PID="$(sudo fuser "$1/tcp" 2>&1 | awk '{print $2}')" +[ -n "$PID" ] || error "No program using port $1!" + +BINPATH="$(\ps "$PID" | awk '{print $5}')" +basename "$BINPATH" |