Documentation, show pid in x-open-ports, tweaks

This commit is contained in:
Ismo Vuorinen
2022-12-15 16:08:06 +02:00
parent 2369eae0ef
commit 7921e079da
5 changed files with 48 additions and 13 deletions

View File

@@ -81,15 +81,15 @@ function section_dotfiles
case "$1" in
link)
rcup -B "$HOSTNAME" -v && echo "🎉 Done!"
rcup -B "$HOSTNAME" -f -v && echo "🎉 Done!"
;;
update)
# Updates .dotfiles/scripts/install.sh and formats it
rcup -B 0 -g \
| tee "$INSTALL_SCRIPT" 1> /dev/null \
&& shfmt -w -l "$INSTALL_SCRIPT" \
&& sed -i '' "s|$HOME|\$HOME|g" "$INSTALL_SCRIPT" \
&& echo "🎉 Done!"
&& sed -i '' "s|$HOME|\$HOME|g" "$INSTALL_SCRIPT"
$0 dotfiles shfmt
echo "🎉 Done!"
;;
shfmt)
# Format shell scripts according to following rules.

View File

@@ -6,14 +6,15 @@
# Originally from: https://www.commandlinefu.com/commands/view/8951
# Original author: https://www.commandlinefu.com/commands/by/wickedcpj
#
echo 'User: Command: Port:'
echo '====================================================='
echo 'User: Command: PID: Port:'
echo '========================================================='
lsof -i 4 -P -n +c 0 \
| grep -i 'listen' \
| awk '{print $3, $1, $9}' \
| awk '{print $3, $1, $2, $9}' \
| sed 's/ [a-z0-9\.\*]*:/ /' \
| sort -k 3 -n \
| xargs printf '%-20s %-25s %-5s\n' | uniq
| xargs printf '%-15s %-25s %-8s %-5s\n' \
| uniq
echo ""