Created
April 6, 2023 08:22
-
-
Save Scarjit/b9a483583ad5fecaed0c74af377ad539 to your computer and use it in GitHub Desktop.
system_info.sh
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 | |
# Get current time | |
current_time=$(date +"%Y-%m-%d_%H-%M-%S") | |
# Set log file name | |
log_file="${current_time}.log" | |
# Gather CPU information | |
echo "---- CPU Information ----" > "$log_file" | |
lscpu >> "$log_file" | |
echo "" >> "$log_file" | |
# Gather RAM information | |
echo "---- RAM Information ----" >> "$log_file" | |
free -h >> "$log_file" | |
echo "" >> "$log_file" | |
# Gather Disk information | |
echo "---- Disk Information ----" >> "$log_file" | |
df -hT >> "$log_file" | |
echo "" >> "$log_file" | |
# Gather Network information | |
echo "---- Network Information ----" >> "$log_file" | |
ip -br a >> "$log_file" | |
echo "" >> "$log_file" | |
# Gather System Uptime information | |
echo "---- System Uptime ----" >> "$log_file" | |
uptime >> "$log_file" | |
echo "" >> "$log_file" | |
echo "System information saved to ${log_file}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment