Skip to content

Instantly share code, notes, and snippets.

@steverobbins
Last active June 12, 2023 23:03
Show Gist options
  • Save steverobbins/530e62b18085b74edee8 to your computer and use it in GitHub Desktop.
Save steverobbins/530e62b18085b74edee8 to your computer and use it in GitHub Desktop.
#!/bin/bash
dynmotd () {
local NONE="\033[0m" # unsets color to term's fg color
# regular colors
local K="\033[0;30m" # black
local R="\033[0;31m" # red
local G="\033[0;32m" # green
local Y="\033[0;33m" # yellow
local B="\033[0;34m" # blue
local M="\033[0;35m" # magenta
local C="\033[0;36m" # cyan
local W="\033[0;37m" # white
local PROCCOUNT=`ps -l | wc -l`
local PROCCOUNT=`expr $PROCCOUNT - 4`
echo -e "$W _ _
| | | | (_)
___ _ __ ___ | |__ | |__ _ _ __ ___
/ __| '__/ _ \| '_ \| '_ \| | '_ \/ __|
\__ \ | | (_) | |_) | |_) | | | | \__ \\
|___/_| \___/|_.__/|_.__/|_|_| |_|___/
${W}┌───────────────────────────────────────────────────────────────────────────────
│ ${W}Hostname:$C `hostname`
${W}│ ${W}IP Address:$C `ifconfig | grep -Eo 'inet (addr:)?([0-9]*\.){3}[0-9]*' | grep -Eo '([0-9]*\.){3}[0-9]*' | grep -v '127.0.0.1'`
${W}│ ${W}Uptime:$C `uptime | sed 's/.*up \([^,]*\), .*/\1/' | xargs`
${W}│ ${W}Sessions:$C `who | grep $USER | wc -l | xargs`
${W}│ ${W}Processes:$C $PROCCOUNT$NONE"
}
dynmotd
unset dynmotd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment