Advertisement
ujiajah1

system_info.sh

May 17th, 2016
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.87 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. # Sample script written for Part 4 of the RHCE series
  4. # This script will return the following set of system information:
  5. # -Hostname information:
  6. echo -e "\e[31;43m***** HOSTNAME INFORMATION *****\e[0m"
  7. hostnamectl
  8. echo ""
  9. # -File system disk space usage:
  10. echo -e "\e[31;43m***** FILE SYSTEM DISK SPACE USAGE *****\e[0m"
  11. df -h
  12. echo ""
  13. # -Free and used memory in the system:
  14. echo -e "\e[31;43m ***** FREE AND USED MEMORY *****\e[0m"
  15. free
  16. echo ""
  17. # -System uptime and load:
  18. echo -e "\e[31;43m***** SYSTEM UPTIME AND LOAD *****\e[0m"
  19. uptime
  20. echo ""
  21. # -Logged-in users:
  22. echo -e "\e[31;43m***** CURRENTLY LOGGED-IN USERS *****\e[0m"
  23. who
  24. echo ""
  25. # -Top 5 processes as far as memory usage is concerned
  26. echo -e "\e[31;43m***** TOP 5 MEMORY-CONSUMING PROCESSES *****\e[0m"
  27. ps -eo %mem,%cpu,comm --sort=-%mem | head -n 6
  28. echo ""
  29. echo -e "\e[1;32mDone.\e[0m"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement