Skip to content

Instantly share code, notes, and snippets.

@misaka4e21
Created May 13, 2014 07:29
Show Gist options
  • Save misaka4e21/81085de1bffb4efe309d to your computer and use it in GitHub Desktop.
Save misaka4e21/81085de1bffb4efe309d to your computer and use it in GitHub Desktop.
安同的aoscey,小图不准确,求重画。
#!/bin/bash
FREEMEM=`free | awk '/^Mem:/{print $4}'`
IE_DISTRO="\033[31mDistribution: \033[37m`lsb_release -i | cut -c17-`\033[36m"
IE_PROCESSOR="\033[31mProcessor: \033[37m`cat /proc/cpuinfo | grep 'model name' | head -n1 | cut -c14-`\033[36m"
IE_ARCH="\033[31mArchitecture: \033[37m`uname -m`\033[36m"
IE_KERNEL="\033[31mKernel: \033[37m`uname -r`\033[36m"
IE_UPTIME="\033[31mUptime: \033[37m`cat /proc/uptime | grep -o '^[0-9]\+'` Minutes\033[36m"
IE_FREERAM="\033[31mFree RAM: \033[37m`expr $FREEMEM / 1024` MiB\033[36m"
IE_SHELL="\033[31mShell: \033[37m`echo $SHELL`\033[36m"
IE_USER="\033[31mUser: \033[37m`whoami`\033[36m"
IE_FREESPACE="\033[31mFree Space on / : \033[37m`df -h / | awk '/[0-9]%/{print $(NF-2)}' | rev | cut -b 2- | rev` GiB\033[36m"
IE_FREESPACE_HOME="\033[31mFree Space on /home : \033[37m`df -h /home | awk '/[0-9]%/{print $(NF-2)}' | rev | cut -b 2- | rev` GiB\033[36m"
IE_TMP_SIZE="\033[31mTemporary Files Size: \033[37m`du -sh -m /tmp 2>/dev/null | awk '{print $1}' | rev | cut -b 1- | rev` MiB\033[36m"
IE_LOG_SIZE="\033[31mLog Files Size: \033[37m`du -sh -m /var/log 2>/dev/null | awk '{print $1}' | rev | cut -b 1- | rev` MiB\033[36m"
IE_DPKG_SIZE="\033[31mDPKG Database Size: \033[37m`du -sh -m /var/lib/dpkg 2>/dev/null | awk '{print $1}' | rev | cut -b 1- | rev` MiB\033[36m"
if [ `tput cols` -ge 120 -a `tput lines` -gt 28 ]
then
echo -e "\033[36m
77777777 $IE_DISTRO
777777777777.
7777777777777777 $IE_PROCESSOR
77777777777777777
7777777777777777777 $IE_ARCH
77777777777777777777
77 7777777777777777 $IE_KERNEL
777777 777777777777777
7777777777 77777777777777. $IE_UPTIME
7777777777777 77777777777777
.777777777777 7777777777777. $IE_FREERAM
7777777777777 7777777777777.
7777777777777 7777777777777. $IE_SHELL
7777777777777 7777777777777
7777777777777 7777777777777 $IE_USER
7777777777777 7777777777777
777777777777777 7777777777 $IE_FREESPACE
777777777777777 7777
7777777777777777 $IE_FREESPACE_HOME
777777777777777777777
777777777777777777777 $IE_TMP_SIZE
..777777777777777777
.77777777777777777 $IE_LOG_SIZE
.777777777777777
.7777777777777 $IE_DPKG_SIZE
777777777 \033[0m"
else
if [ `tput cols` -lt 120 -a `tput lines` -gt 23 ]
then
echo -e "\033[36m
77777.
77 77777777..
77777 7777777777..
7777777 77777777
7777777 7777777
77777 7777777
777777 7777777.
7777777. 7777777.
7777777777 77.
777777777
...77\033[0m
$IE_DISTRO
$IE_PROCESSOR
$IE_ARCH
$IE_KERNEL
$IE_UPTIME
$IE_FREERAM
$IE_SHELL
$IE_USER
$IE_FREESPACE
$IE_FREESPACE_HOME
$IE_TMP_SIZE
$IE_LOG_SIZE
$IE_DPKG_SIZE"
else
if [ `tput cols` -gt 70 -a `tput lines` -gt 13 ]
then
echo -e "\033[36m
77777. $IE_DISTRO
77 77777777.. $IE_PROCESSOR
77777 7777777777.. $IE_ARCH
7777777 77777777 $IE_KERNEL
7777777 7777777 $IE_UPTIME
77777 7777777 $IE_FREERAM
777777 7777777. $IE_SHELL
7777777. 7777777. $IE_USER
7777777777 77. $IE_FREESPACE
777777777 $IE_FREESPACE_HOME
...77 $IE_TMP_SIZE
$IE_LOG_SIZE
$IE_DPKG_SIZE \033[0m"
else
echo -e "$IE_DISTRO
$IE_PROCESSOR
$IE_ARCH
$IE_KERNEL
$IE_UPTIME
$IE_FREERAM
$IE_SHELL
$IE_USER
$IE_FREESPACE
$IE_FREESPACE_HOME
$IE_TMP_SIZE
$IE_LOG_SIZE
$IE_DPKG_SIZE"
fi
fi
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment