Skip to content

Instantly share code, notes, and snippets.

@Scarjit
Created April 6, 2023 08:22
Show Gist options
  • Save Scarjit/b9a483583ad5fecaed0c74af377ad539 to your computer and use it in GitHub Desktop.
Save Scarjit/b9a483583ad5fecaed0c74af377ad539 to your computer and use it in GitHub Desktop.
system_info.sh
#!/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