From da4c508afaffa06aa95731571106bcb325567e29 Mon Sep 17 00:00:00 2001 From: gaardhus Date: Fri, 8 Nov 2024 16:07:04 +0100 Subject: [PATCH] remove susers utility and add kuids --- docs/server/tips.md | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/docs/server/tips.md b/docs/server/tips.md index 56cfbc6..5c4c6fe 100644 --- a/docs/server/tips.md +++ b/docs/server/tips.md @@ -240,19 +240,26 @@ id | tr "," "\n" | grep srv-sodas Check users logged on the server ```bash +users w ``` -Check users with access to the server +Custom function to lookup multiple KUIDs (can be added to `.bashrc`): ```bash -function susers() { - for user in /home/*; do - username=$(basename $user) - if [[ $username =~ ^[a-zA-Z]{3}[0-9]{3}$ ]]; then - kuid "$username" - echo "============================" - fi +function kuids() { + while read -r username; do + if [[ $username =~ ^[a-zA-Z]{3}[0-9]{3}$ ]]; then + kuid "$username" + echo "============================" + fi done } ``` + +Usage: + +```bash +ls /home/ | kuids +users | kuids +```