Category Archives: UNIX & Linux Code Snippets

GNU and UNIX Commands: Sending HTML-formatted email from the Command Line

Some brief notes I made on sending HTML mail (with an optional attachment) from the command line.

SSL - How to Check an HTTPS webserver

It’s easy to telnet to port 80 on a “standard” non-SSL webserver, and issue a GET / in order to verify that the webserver is responding correctly. But how to do it over SSL? Just use the s_client command via the openssl tool.


You’ll see details of the certificate chain displayed (as well as any errors), and you can then issue your GET / to test the webservers operation.

You can also use this tool to test other SSL-enabled services (such as IMAPS/POP3S).

Launching Simultaneous Processes and Monitoring Exit Statuses

Let’s say you have three scripts. You want to execute them simultaneously (or as close to simultaneous as is practicable). You then want to examine all of their exit statuses, and maybe perform some actions accordingly.

The easiest way is using a script such as the following, capturing the PID of each process as it is launched, and then using wait to wait for the specified process to return its termination status. For example:

Code Snippets: Link Checking with curl

Even though there are many link checking utilities and scripts available, a simple concise report can be generated using curl.

Create a script, link_checker.sh, and paste the following code:

Now, place your links, one per line, in the file links, e.g.

Then, make the script executable and run it. Links will be checked, and the HTTP status code of each one returned.