Created
February 10, 2015 19:28
-
-
Save jackprice/57c2595d638271b496de to your computer and use it in GitHub Desktop.
Bash motd
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# Shell script to print a motd with various bits of information about the system | |
# Included from .bashrc | |
# | |
# Get hostname | |
HOSTNAME=$(hostname) | |
# Get kernel version | |
KERNEL="$(uname -r) ($(uname -s))" | |
# Get uptime | |
UPTIME=$(uptime | sed 's/.*up \([^,]*\),.*/\1/') | |
# Get users | |
USERS=$(w | head -1 | sed 's/^.*\([0-9][0-9]*\) users.*$/\1/') | |
# Get storage | |
STORAGE=$(df / | grep / | awk '{print $8}') | |
# Get PHP version | |
PHP=$(php -v | egrep -o 'PHP [0-9]+\.[0-9]+\.[0-9]+' | awk '{print $2}') | |
# Echo | |
echo -e " | |
Hostname:\033[2m $HOSTNAME \033[0m | |
Kernel:\033[2m $KERNEL \033[0m | |
Uptime:\033[2m $UPTIME \033[0m | |
Users:\033[2m $USERS \033[0m | |
Storage:\033[2m $STORAGE used \033[0m | |
PHP:\033[2m $PHP \033[0m | |
" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment