Skip to content

A collection of inspiring lists, manuals, cheatsheets, blogs, hacks, one-liners, cli/web tools and more.

test if the current user is sudo-su'd into this session - signed-off-by: lbonanomi <[email protected]>

lbonanomi985714befd12
diff --git a/README.md b/README.md
index 807b60f..9a6178c 100644
--- a/README.md
+++ b/README.md
@@ -1227,6 +1227,12 @@ ___
who -b
```
+###### Detect a user sudo-su'd into the current shell
+
+```
+[[ $(who -m | awk '{ print $1 }') == $(whoami) ]] || echo "You are su-ed to $(whoami)"
+```
+
___
##### Tool: [screen](https://en.wikipedia.org/wiki/GNU_Screen)