Last active
November 7, 2019 11:25
-
-
Save fridzema/f98b33513bb010e48fa0ed01369c8f56 to your computer and use it in GitHub Desktop.
system-info
This file contains 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
#!/bin/bash | |
# Sample script written for Part 4 of the RHCE series | |
# This script will return the following set of system information: | |
# -Hostname information: | |
echo -e "\e[31;43m***** HOSTNAME INFORMATION *****\e[0m" | |
hostnamectl | |
echo "" | |
# -File system disk space usage: | |
echo -e "\e[31;43m***** FILE SYSTEM DISK SPACE USAGE *****\e[0m" | |
df -h | |
echo "" | |
# -Free and used memory in the system: | |
echo -e "\e[31;43m ***** FREE AND USED MEMORY *****\e[0m" | |
free | |
echo "" | |
# -System uptime and load: | |
echo -e "\e[31;43m***** SYSTEM UPTIME AND LOAD *****\e[0m" | |
uptime | |
echo "" | |
# -Logged-in users: | |
echo -e "\e[31;43m***** CURRENTLY LOGGED-IN USERS *****\e[0m" | |
who | |
echo "" | |
# -Top 5 processes as far as memory usage is concerned | |
echo -e "\e[31;43m***** TOP 5 MEMORY-CONSUMING PROCESSES *****\e[0m" | |
ps -eo %mem,%cpu,comm --sort=-%mem | head -n 6 | |
echo "" | |
echo -e "\e[1;32mDone.\e[0m" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment