A more or less complete list of commands and configuration files for Ubuntu Linux.
Main macOS Sonoma 14.5 commands.
Main Windows PowerShell Commands.
Main Windows cmd prompt commands.
Docker Best practices.

Docker has revolutionized the world of containerization, enabling scalable and efficient application deployment.
To make the most of this powerful tool, here are 10 essential Docker best practices:
𝗦𝘁𝗮𝗿𝘁 𝘄𝗶𝘁𝗵 𝗮 𝗟𝗶𝗴𝗵𝘁𝘄𝗲𝗶𝗴𝗵𝘁 𝗕𝗮𝘀𝗲 𝗜𝗺𝗮𝗴𝗲: Use minimalist base images to reduce container size and vulnerabilities.
𝗦𝗶𝗻𝗴𝗹𝗲 𝗣𝗿𝗼𝗰𝗲𝘀𝘀 𝗽𝗲𝗿 𝗖𝗼𝗻𝘁𝗮𝗶𝗻𝗲𝗿: Keep it simple – one process per container for better isolation and maintainability.
𝗨𝘀𝗲 𝗗𝗼𝗰𝗸𝗲𝗿 𝗖𝗼𝗺𝗽𝗼𝘀𝗲: Define multi-container applications in a YAML file for easy management.
𝗩𝗼𝗹𝘂𝗺𝗲 𝗠𝗼𝘂𝗻𝘁𝗶𝗻𝗴: Store data outside the container to preserve it, even if the container is removed.
𝗖𝗼𝗻𝘁𝗮𝗶𝗻𝗲𝗿 𝗢𝗿𝗰𝗵𝗲𝘀𝘁𝗿𝗮𝘁𝗶𝗼𝗻: Consider Kubernetes or Docker Swarm for managing containers at scale.
𝗩𝗲𝗿𝘀𝗶𝗼𝗻𝗶𝗻𝗴 𝗮𝗻𝗱 𝗧𝗮𝗴𝗴𝗶𝗻𝗴: Always tag images with version numbers to ensure reproducibility.
𝗛𝗲𝗮𝗹𝘁𝗵 𝗖𝗵𝗲𝗰𝗸𝘀: Implement health checks to monitor container status and reliability.
𝗥𝗲𝘀𝗼𝘂𝗿𝗰𝗲 𝗟𝗶𝗺𝗶𝘁𝘀: Set resource constraints to prevent one container from hogging resources.
𝗗𝗼𝗰𝗸𝗲𝗿𝗳𝗶𝗹𝗲 𝗕𝗲𝘀𝘁 𝗣𝗿𝗮𝗰𝘁𝗶𝗰𝗲𝘀: Optimize Dockerfiles by minimizing layers and using caching effectively.
𝗦𝗲𝗰𝘂𝗿𝗶𝘁𝘆: Regularly update images, scan for vulnerabilities, and follow security best practices.
Install Docker on Linux with a single command.
Run this to install Docker:
$ curl -fsSL get.docker.com | sh
To preview the installation steps first:
$ curl -fsSL get.docker.com -o get-docker.sh
$ sudo sh ./get-docker.sh –dry-run
How to Send Email using Shell Script (gmail).
In this article, we will learn how to send email using shell scripting. Sending emails programmatically can be very useful for automated notifications, error alerts, or any other form of communication that needs to be sent without manual intervention. Shell scripting offers a powerful way to achieve this through various utilities and tools available in Unix-like operating systems.
Prerequisites
- AWS Account with Ubuntu 24.04 LTS EC2 Instance.
- Basic knowledge of Shell scripting.
Step #1:Generate the App Password
First go to your account:

Search for App Password in the search bar.

Enter your google account password to verify it’s you:

Now Enter the app name for which you wanted to get the app password like Shell Script.
And click on Create to create it:

the password will be generated. Note it down cause will be using it.

Step #2:Create a file in Ubuntu
Open the terminal and use the nano command to create a new file:
nano email.sh
Step #3:Write a Script to Send Emails
Below is a basic script to send an email.
-----------------------------------------
#!/bin/bash
# Prompt the user for input
read -p "Enter your email: " sender
read -p "Enter recipient email: " receiver
read -s -p "Enter your Google App password: " gapp
echo
read -p "Enter the subject of mail: " sub
# Read the body of the email
echo "Enter the body of mail (Ctrl+D to end):"
body=$(</dev/stdin)
# Sending email using curl
response=$(curl -s --url 'smtps://smtp.gmail.com:465' --ssl-reqd \
--mail-from "$sender" \
--mail-rcpt "$receiver" \
--user "$sender:$gapp" \
-T <(echo -e "From: $sender\nTo: $receiver\nSubject: $sub\n\n$body"))
if [ $? -eq 0 ]; then
echo "Email sent successfully."
else
echo "Failed to send email."
echo "Response: $response"
fi
------------------------------------------

Save the file and exit the editor.
Explanation of the Script:
This script is designed to send an email using Gmail’s SMTP server through the command line. Here’s a step-by-step explanation of each part of the script:
- Shebang: The
#!/bin/bash
line at the beginning of the script indicates that the script should be run using the Bash shell. - User Input Prompts: These lines prompt the user to enter
- The sender’s email address.
- The recipient’s email address.
- The sender’s Google App password (entered silently using
-s
to hide the input). - The subject of the email.
- Reading the Email Body: This section prompts the user to enter the body of the email. The user can type the email content and end input by pressing
Ctrl+D
. The body of the email is then captured into the variablebody
. - Sending the Email: This part of the script uses
curl
to send the email-s
makescurl
run silently.--url 'smtps://smtp.gmail.com:465'
specifies the Gmail SMTP server with SSL on port 465.--ssl-reqd
ensures SSL is required.--mail-from "$sender"
specifies the sender’s email address.--mail-rcpt "$receiver"
specifies the recipient’s email address.--user "$sender:$gapp"
provides the sender’s email and Google App password for authentication.-T <(echo -e "From: $sender\nTo: $receiver\nSubject: $sub\n\n$body")
sends the email content including headers and body.
- Handling the Response: This final part checks the exit status of the
curl
command ($?
):- If the exit status is
0
, it prints “Email sent successfully.” - If the exit status is not
0
, it prints “Failed to send email.” and outputs the response fromcurl
.
- If the exit status is
Step #4:Make file executable
Change the file permissions to make it executable using the chmod command:
chmod +x email.sh
Step #5:Run the script
Run the script by executing the following command:
./email.sh
You will be prompted to enter the sender’s email, recipient’s email, Google App password, subject, and body of the email:

You will get the message Email sent successfully.
Now check the mail box to see if you receive the mail or not.

Conclusion:
In conclusion, sending emails using shell scripting can greatly enhance your automation tasks, enabling seamless communication and notifications. This approach is especially useful for automated notifications, error alerts, and other routine communications. With the power of shell scripting, you can integrate emails functionality into your workflows, ensuring timely and efficient information exchange.
Shell Script to send email if multiple websites are down (gmail).
In this article, we will learn Shell Script to send email if website down, how to automate the process of checking the status of URLs and sending email notifications if any of them are down. When a website goes down or experiences issues, it’s essential to be promptly notified so that necessary actions can be taken to restore its functionality.
One effective way to achieve this is by automating email notifications to alert system administrators or stakeholders about the status of URLs. We’ll utilize shell scripting to create a simple yet effective solution for monitoring website health and ensuring timely notifications in case of any disruptions.
Prerequisites
- AWS Account with Ubuntu 24.04 LTS EC2 Instance.
- Basic knowledge of Shell scripting.
Step #1:Generate the App Password
First go to your account.

Search for App Password in the search bar.

Enter your google account password to verify it’s you.

Now Enter the app name for which you wanted to get the app password like URL Notification.
And click on Create to create it

the password will be generated. Note it down cause will be using it

Step #2:Create a file in Ubuntu
Open the terminal and use the nano command to create a new file.
nano url_notify.sh
----------------------------------------------------
Step #3:Write a Script to Send Email Notification
Below is a basic script to send an email notification if any of the url’s are down:
----------------------------------------------------
#!/bin/bash
# Prompt the user for input
read -p "Enter your email: " sender
read -p "Enter recipient email: " receiver
read -s -p "Enter your Google App password: " gapp
echo
# List of URLs to check
urls=("https://www.example.com" "https://www.google.com" "https://www.openai.com")
# Function to check the status of URLs and send email notification if any are down
check_urls_and_send_email() {
local down_urls=""
local subject="Website Down"
for url in "${urls[@]}"; do
response=$(curl -Is "$url" | head -n 1)
if [[ ! $response =~ "200" ]]; then
down_urls+="$url\n"
fi
done
if [[ -n $down_urls ]]; then
body="The following websites are down:\n\n$down_urls"
email_content="From: $sender\nTo: $receiver\nSubject: $subject\n\n$body"
response=$(curl -s --url 'smtps://smtp.gmail.com:465' --ssl-reqd \
--mail-from "$sender" \
--mail-rcpt "$receiver" \
--user "$sender:$gapp" \
-T <(echo -e "$email_content"))
if [ $? -eq 0 ]; then
echo "Email sent successfully."
else
echo "Failed to send email."
echo "Response: $response"
fi
else
echo "All websites are up."
fi
}
# Call the function to check URLs and send email
check_urls_and_send_email
-------------------------------------------------

Save the file and exit the editor.
Explanation of the Script:
- User Input Prompt:
- The script prompts the user to enter their email address (sender), recipient’s email address (receiver), and Google App password (gapp).
- List of URLs:
- The script defines an array urls containing the URLs to be checked for their status. These URLs represent the websites whose availability we want to monitor.
- Function to Check URLs and Send Email:
- The check_urls_and_send_email() function iterates through each URL, using curl to check their status. If any URLs are found to be down, it constructs and sends an email notification containing details of the down URLs to the specified recipient. The email is sent using SMTPS protocol with SSL, and the script handles the response to determine the success of the email sending operation.
- Function Call:
- The script calls the check_urls_and_send_email function to initiate the process of checking URL statuses and sending email notifications.
Step #4:Make file executable
Change the file permissions to make it executable using the chmod command.
chmod +x url_notify.sh
Step #5:Run the script
Run the script by executing the following command.
./url_notify.sh
You will be prompted to enter the sender’s email, recipient’s email and Google App password:

You will receive the message Email sent successfully.
Now check the mail box to verify if you received the mail or not.

Conclusion:
In conclusion, automating email notifications for URL status monitoring using shell scripting is a proactive approach to ensuring the continuous availability and performance of critical web services and applications. By implementing a simple shell script, organizations can establish an efficient mechanism for monitoring URL health and receiving timely alerts in case of any disruptions. By following the steps outlined in this article, organizations can enhance their website monitoring capabilities and minimize downtime, ultimately improving the overall reliability and user experience of their online services.
AWS Services cheatsheet.
