diff options
| author | subh <subh@subh.space> | 2026-03-30 00:26:56 +0530 |
|---|---|---|
| committer | subh <subh@subh.space> | 2026-03-30 00:26:56 +0530 |
| commit | 4d209f7c9208b5ee3ec4fe642084d523d0ea5a7e (patch) | |
| tree | b09ea1ad33d5fc738a4ce20f752235e336820b04 /scripts/pid2ps | |
| parent | 759e0c0677c55e99361538054ed87bf7060c654f (diff) | |
Lots of changes
Diffstat (limited to 'scripts/pid2ps')
| -rwxr-xr-x | scripts/pid2ps | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/scripts/pid2ps b/scripts/pid2ps new file mode 100755 index 0000000..25cb6e5 --- /dev/null +++ b/scripts/pid2ps @@ -0,0 +1,22 @@ +#!/bin/bash + +# Simple PID to PS resolver + +pid=$1 +if [[ -z $pid ]]; then + echo "[*] Usage: pid2ps <PID>" + exit 1 +fi + +if [[ $pid =~ ^[0-9]+$ ]]; then + if name=$(/bin/cat /proc/$pid/comm 2>/dev/null); then + echo $name + else + echo "[!] No such process" + exit 1 + fi +else + echo "[!] Invalid PID" + exit 1 +fi + |
