SHARE
TWEET

Show some informations on terminal

MrOccan Nov 6th, 2013 50 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #############################################"
  2. # Show some useful informations.
  3. #############################################"
  4. echo -e "\E[01;31mThe terminal \E[01;33m[ $(date "+%a %d, %Y") ]\n"
  5. # User and hostname.
  6. echo -e "\E[01;30mUser: \E[00m$USER\t\t\E[01;30mHostname: \E[00m$HOSTNAME"
  7. # OS and kernel version.
  8. echo -e "\E[01;30mOS: \E[00mX$(echo $(head -n 2 /etc/lsb-release | awk -F = '{print $2}')" ") \t\E[01;30mKernel: \E[00m$(uname -r)"
  9. # Size of root and home partitions.
  10. echo -e "\E[01;30mRoot: \E[00m$(df -h / | awk '/^\//{print $3"/"$2}')\t\t\E[01;30mHome: \E[00m$(df -h /home | awk '/^\//{print $3"/"$2}')"
  11. # CPU percentage and used RAM.
  12. echo -e "\E[01;30mCPU: \E[00m$(top -b -n2 -d 0.05 | grep -i "^CPU" | tail -n 1 | awk '{print $2+$4"%"}')                \E[01;30mRAM: \E[00m$(free -m | awk '/^-/{print $3"Mb"}')"
  13. # Uptime.
  14. echo -e "\E[01;30mUptime: \E[00m$(uptime | awk -F "up" '{print $2}' | awk -F ",  . user" '{print $1}' | tr -d "[:blank:]")\n"
RAW Paste Data
Top