Skip to content

Instantly share code, notes, and snippets.

@UtsuhoRocks
Last active December 5, 2022 16:24
Show Gist options
  • Save UtsuhoRocks/4a8f8d423e79b5b7c8dfd01e3153faab to your computer and use it in GitHub Desktop.
Save UtsuhoRocks/4a8f8d423e79b5b7c8dfd01e3153faab to your computer and use it in GitHub Desktop.
#!/bin/sh
echo -e "$(whoami)@$(hostname)"
echo "------------------------------------"
echo "System Information:"
echo -e "\tHostname: $(hostname)"
echo -e "\tOperating System: $(uname -o) $(uname -r)"
echo -e "\tKernel Version: $(uname -v)"
echo -e "\tUptime: $(uptime)"
echo "CPU Information:"
echo -e "\tModel: $(grep 'model name' /proc/cpuinfo | head -1 | cut -d ':' -f2)"
echo -e "\tCores: $(grep 'cpu cores' /proc/cpuinfo | head -1 | cut -d ':' -f2)"
echo -e "\tClock Speed: $(grep 'cpu MHz' /proc/cpuinfo | head -1 | cut -d ':' -f2) MHz"
echo "Memory Information:"
echo -e "\tTotal: $(free -m | grep Mem | awk '{print $2}') MB / $(free -g | grep Mem | awk '{print $2}') GB"
echo -e "\tUsed: $(free -m | grep Mem | awk '{print $3}') MB / $(free -g | grep Mem | awk '{print $3}') GB"
echo -e "\tFree: $(free -m | grep Mem | awk '{print $4}') MB / $(free -g | grep Mem | awk '{print $4}') GB"
echo "Swap Information:"
echo -e "\tTotal: $(free -m | grep Swap | awk '{print $2}') MB / $(free -g | grep Swap | awk '{print $2}') GB"
echo "User Information:"
echo -e "\tUsername: $(whoami)"
echo -e "\tShell: $(echo $SHELL)"
echo -e "\tTerminal: $(echo $TERM)"
#!/bin/sh
printf "%s@%s\n" "$(whoami)" "$(hostname)"
echo "------------------------------------"
echo "System Information:"
printf "\tHostname: %s\n" "$(hostname)"
printf "\tOperating System: %s %s\n" "$(uname -o)" "$(uname -r)"
printf "\tKernel Version: %s\n" "$(uname -v)"
printf "\tUptime: %s\n" "$(uptime)"
echo "CPU Information:"
printf "\tModel: %s\n" "$(grep 'model name' /proc/cpuinfo | head -1 | cut -d ':' -f2)"
printf "\tCores: %s\n" "$(grep 'cpu cores' /proc/cpuinfo | head -1 | cut -d ':' -f2)"
printf "\tClock Speed: %s MHz\n" "$(grep 'cpu MHz' /proc/cpuinfo | head -1 | cut -d ':' -f2)"
echo "Memory Information:"
printf "\tTotal: %s MB / %s GB\n" "$(free -m | grep Mem | awk '{print $2}')" "$(free -g | grep Mem | awk '{print $2}')"
printf "\tUsed: %s MB / %s GB\n" "$(free -m | grep Mem | awk '{print $3}')" "$(free -g | grep Mem | awk '{print $3}')"
printf "\tFree: %s MB / %s GB\n" "$(free -m | grep Mem | awk '{print $4}')" "$(free -g | grep Mem | awk '{print $4}')"
echo "Swap Information:"
printf "\tTotal: %s MB / %s GB\n" "$(free -m | grep Swap | awk '{print $2}')" "$(free -g | grep Swap | awk '{print $2}')"
echo "User Information:"
printf "\tUsername: %s\n" "$(whoami)"
printf "\tShell: %s\n" "$(echo $SHELL)"
printf "\tTerminal: %s\n" "$(echo $TERM)"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment