When we are dropped in a terminal of a server we will need to gather basic information on the system using the below commands:
1- How to know the which OS we are in ?
cat /etc/os-release
2- How to know which kernel we are using ?
#!/bin/bash | |
# if you have profiles other than default unhash the below line and profide the profile name | |
#export AWS_PROFILE=NAME | |
recoverfiles=$(aws s3api list-object-versions --bucket BUCKET_NAME --prefix FOLDER_NAME/ --query "DeleteMarkers[?IsLatest && starts_with(LastModified,'2021-02-16')].{Key:Key,VersionId:VersionId}") | |
for row in $(echo "${recoverfiles}" | jq -c '.[]'); do | |
key=$(echo "${row}" | jq -r '.Key' ) | |
# versionId=$(echo "${row}" | jq -r '.VersionId' ) | |
aws s3api delete-object --bucket inno-themes-prod --key $key --version-id null | |
done |
#!/bin/bash | |
# A bash script to update a Cloudflare DNS A record with the external IP of the source machine | |
# Used to provide DDNS service for my home | |
# Needs the DNS record pre-creating on Cloudflare | |
# Proxy - uncomment and provide details if using a proxy | |
#export https_proxy=http://<proxyuser>:<proxypassword>@<proxyip>:<proxyport> | |
# Cloudflare zone is the zone which holds the record |
#!/bin/bash | |
cores=$(lscpu | egrep "^CPU\(s\)") | |
cpu_model=$(grep "model name" /proc/cpuinfo | uniq) | |
ram=$(free -g | grep Mem | awk '{ print $2 }') | |
red="\e[91m" | |
norm="\e[0m" | |
echo -e "$red | |
CPU INFO:\n $norm | |
$cores | |
$cpu_model |