How to Setup HTTPS for Free With Terminal

In this article, I’ll show you how to setup HTTPS for your website as long as you have shell/terminal access.

  • We host slothparadise on Amazon Web Services EC2, so we do have shell access to the website.

You should visit to get customized instructions for your operating system and web server. Let’s Encrypt has more information.


1.  Find out what type of web server and operating system you are using.

Open a terminal and ssh into your website.

ssh [email protected]

Once you are connected, you will see what version of your operating system.

Welcome to Ubuntu 14.04.5 LTS (GNU/Linux 3.13.0-24-generic x86_64)

Next, you should find out what type of web server you are running. I know beforehand that I am running an apache server, so I should check the status of apache.

~$ sudo service apache2 status
* apache2 is running

As a result, at the website, I’ll select Apache for Software and Ubuntu 14.04 (trusty) for System.


2. Follow the instructions that pop up.

Next up is simply following the instructions for Certbot.

$ sudo add-apt-repository ppa:certbot/certbot

$ sudo apt-get update

$ sudo apt-get install python-certbot-apache

Type Y to continue.

certbot is ready to be used, but we still need to check if the 443 port is ready.


3. Check if port 443 is open.

$ sudo apt-get install nmap

nmap is a useful tool on Ubuntu to see what ports you have open.

$ nmap localhost
Starting Nmap 6.40 ( ) at 2017-04-30 03:52 UTC
Nmap scan report for localhost (
Host is up (0.00028s latency).
Not shown: 997 closed ports
22/tcp open ssh
80/tcp open http
3306/tcp open mysql

Nmap done: 1 IP address (1 host up) scanned in 0.04 seconds

nmap shows that I do not have 443/tcp open, so that means that I need to add open port 443.


4. Open port 443 if it’s not open.

Since I host the website on Amazon Web Services EC2, I have to visit and log into my account.

Once I’m on my dashboard, I need to visit EC2.

Next, I click on Running Instances.

I click on the running instance that I want to edit, and the checkbox becomes blue.

Afterwards, I look at the bottom of the page where there is additional information in the Description tab and click on the name of the Security Group.

If you click on Actions, you can Edit inbound rules of the Security Group.

For Edit inbound rules, we want to Add Rule HTTPS.



Hit Save.


5. Use cerbot to add HTTPS to your website.

$ sudo certbot --apache

You will get a message to choose whether to allow both HTTP and HTTPS access or only HTTPS. I like option 2, so I type 2 and hit Enter.

If everything worked properly, you should get a Congratulations message.

Now, you can visit your website with HTTPS. Huzzah!


Automatic HTTPS certificate renewal

You will also get a message that your certificate will only last 3 months, but luckily, it should renew by itself.

Your cert will expire on 2017-07-29. To obtain a new or tweaked version of this certificate in the future, simply run certbot again with the "certonly" option. To non-interactively renew *all* of your certificates, run "certbot renew"

However, the Certbot packages on your system come with a cron job that will renew your certificates automatically before they expire. Since Let’s Encrypt certificates last for 90 days, it’s highly advisable to take advantage of this feature.

You can check the certbot cron entries (automated scheduler):

vim /etc/cron.d/certbot

0 */12 * * * means every 12 hours.

You can test automatic renewal for your certificates to make sure that this automatic renewal will work in the future by running the following command. I like to test that certbot will renew correctly.

certbot renew --dry-run


Always redirect to HTTPS

What controls the redirection to HTTPS on apache is the .htaccess file.

You can follow Namecheap’s official documentation on how to force a HTTPS redirection.

.htaccess is typically found in the /var/www/html folder

$ sudo vim /var/www/html/.htaccess

In my .htaccess file, I made sure to have a section with the following:

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ https://www.%{HTTP_HOST}/$1 [R=301,L]
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]

php_flag display_errors 1

This snippet’s most important part is the RewriteRule that states the redirection to https version of the website.

Save the file and restart apache.

sudo service apache2 restart
 * Restarting web server apache2 [ OK ]

Your website should now always redirect to HTTPS.

How to Setup Bash on Windows 10 for Developers – Ultimate Setup

Bash for Windows 10 has been out for almost a year now. It has been incredible for a developer like myself to be able to use Bash natively on a Windows machine!

In this article, I’ll show you how I install my main Bash setup for Windows 10.



  1. Your Windows 10 PC must be running a 64-bit version of Windows 10 Anniversary Update build 14393 or later.
    To find your PC's CPU architecture and Windows version/build number, open Settings>System>About. Look for the System type and OS Build fields.

    In this screenshot, I have a 64-bit operating system, x64-based processor and OS Build, 15063.138, so I fit the requirements.



  1. Install Bash on Windows 10
  2. Install ConEmu for tabs
  3. Must have Bash customizations
  4. Install VcXsrv Windows X Server for opening GUI applications


1. Install Bash on Windows 10

In order to run Bash on Windows, you will need to manually:

  1. Turn on Developer Mode
  2. Enable the “Windows Subsystem for Linux (beta)” feature

Open Settings -> Update and Security -> For developers
Select the Developer Mode radio button.

Developer mode is selected.

From Start, search for “Turn Windows features on or off” (type ‘turn’)
Select Windows Subsystem for Linux (Beta)

Windows Subsystem for Linux (Beta) is checked.

Hit OK. Installation will proceed, and afterwards, you will have to restart your computer.

After you restart your computer, you will be able to finish installing Bash on Windows 10.

Search for Microsoft Store.

From the Microsoft Store, find Ubuntu and download and install it.

From Start, search for “bash” (type ‘bash’) or it might already be open.

When you open bash, you will see a command prompt window.

Type "y" to continue.

The real “Bash on Ubuntu on Windows” shortcut will be installed. Bash on Ubuntu on Windows might already be installed through the Microsoft Store.

Now, you can open “Bash on Ubuntu on Windows” whenever you search for “bash”

Try opening Bash.  The first time you install Bash on Windows, you will be prompted to create a UNIX username and password.

After typing in a UNIX user name and UNIX password, you can use Bash the same way that you would use a terminal on Mac and Linux.

The biggest problem though is there are no tabs! Let’s fix the tab issue.


2. Install ConEmu for tabs

ConEmu is an amazing program that gives you terminal tabs, allows you to copy and paste the normal way with CTRL-C and CTRL-V, and run any combinations of shells including Command Prompt, Bash, Powershell, and more.

Hi the Download button, which will take you to a redirected list of versions of ConEmu. I like to use the Preview version.

Run the executable. Select the x64 bit version of installation.

Hit Next on the next few prompts, which are the intro window, license and agreement, and settings. I leave everything by default.

Now, you are ready to install. Hit Install.

Hit Finish on the next prompt.

From Start, search for “ConEmu” (type ‘ConEmu’)

When ConEmu first starts, you will be brought to the Startup Settings. You have to select the default console that you want to open.

Find and select {Bash::bash} in the Specified named task section.

Now, whenever you open ConEmu, it will open to Bash by default! ConEmu is easy to read and smooth.

I like to pin ConEmu to the taskbar to be able to open bash quickly. Right click ConEmu’s icon and click Pin to taskbar.

To add a new tab on ConEmu, type WIN+W.

To switch to the right tab, type CTRL+Tab.

To switch to the left tab, type CTRL+Shift+Tab.

All ConEmu’s shortcuts are listed:


3. Must have Bash customizations

Bash on Windows 10 is great, but it could use a few customizations to make using it with Windows 10 files and programs easier!

First, we will adjust our ~/.bashrc.

nano ~/.bashrc

Use any text editor. On nano, type ALT+/ to go to the end of the file.

These configurations allow easy access to some of my favorite Windows related directories and programs.

I want to be able to change directory to the Windows C: drive easily and access my desktop, so I use aliases.

alias converts the given word into shortcuts.

I also want to be able to use Sublime, which is my go-to GUI text editor, so that I can type subl . and open the current working directory with Sublime.

I am using Sublime 3

I want to be able to open any folder with File Explorer with open, so that I can open the current working directory with open .

I have a shortcut called linux to open the Ubuntu’s root folder with File Explorer.

Lastly, I have an alias called reload for reloading the ~/.bashrc to apply any new configurations.

Replace huyle with the username of your computer.

# Custom shortcuts
alias windows="cd /mnt/c"
alias desktop="cd /mnt/c/Users/huyle/Desktop"
alias subl="/mnt/c/Program\ Files/Sublime\ Text\ 3/subl.exe"
alias open="/mnt/c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe /c start -WorkingDirectory C:'\\'Users'\\'huyle'\\'AppData'\\'Local'\\'lxss"
alias linux="open C:/Users/huyle/AppData/Local/lxss"
alias reload="source ~/.bashrc"

These other shortcuts I use to access my favorite directories. I recommend you to add your favorite Windows or Ubuntu directories where you put your development code or work.

# Optional shortcuts
alias repos="cd /mnt/c/Users/huyle/Desktop/Repos"
alias work="cd /mnt/c/Users/huyle/Desktop/Work"
alias youtube="cd /mnt/c/Users/huyle/Desktop/YouTube"

You can save your file with nano by using CTRL+O and then pressing Enter.

Now, we can apply these changes.

source ~/.bashrc

Use the windows alias to easily switch to your Windows files! You can try some of these other aliases!

open .

The open alias does not work with Ubuntu’s directories because of directory translation errors, but by default, at least, I set the alias to open the Ubuntu root directory.

Every now and then, I prefer using Sublime, so it’s very convenient to be able to type subl . in order to open current working directories with Sublime.

Here are some extra utilities that I like to install on Bash. These utilities are optional.

I like to use tmux, which is a terminal multiplexer. It lets you switch easily between several programs in one terminal.

I like tabs, but every now and then, I like everything in one terminal for a bird’s eye view.

I also like to use zip and unzip often to create zip files and extract them.

sudo apt-get install -y tmux zip unzip

Nice! Bash on Windows 10 with tabs and tmux feels so good. Your development is now super-charged!


4. Install VcXsrv Windows X Server for opening GUI applications

If you have ever wanted to open GUI applications through SSH connections, this step is for you.

By default, Windows 10 does not come with an X11 server by default. I’ve been using VcXsrv Windows X Server, but Xming also works.

You can download VcXsrv Windows X Server here:

Hit the Download green button.

I leave the settings by default.

You can open VcXsrv by searching for “vcx” on Windows 10 search.

I Allow access for VcXsrv Public networks.

Now that we have our X11 server open, we should adjust our ~/.bashrc a little bit to make sure that the DISPLAY value will be correct.

vim ~/.bashrc
# X11 server display value
export DISPLAY=localhost:0.0

Let’s test if our X11 server works! I like to install x11-apps for testing.

x11-apps contains xclock, which is great for testing GUI applications and X11.

sudo apt-get install -y x11-apps

Now, let’s run xclock.


Last but not least, let’s make sure that X11 will work on top of SSH connections.

mkdir ~/.ssh
vim ~/.ssh/config
Host *
    ForwardAgent yes
    ForwardX11 yes

Now, save the ssh config file and change its permissions correctly.

chmod 600 ~/.ssh/config

Afterwards, you should be able to use -X with ssh in order to enable the forwarding of X11 connections to VcXsrv.

ssh -X [email protected]_address

Great job! Good luck with your development. I’ve been finding this setup very comfortable as a developer!

How to Create Bootable USB Flash Drive of CentOS 7 Minimal ISO

This article will provide the step to step instructions to create a bootable USB flash drive of CentOS 7 Minimal ISO on Windows, Mac, or Linux. The CentOS instance that we will install onto the bootable USB flash drive is CentOS-7-x86_64-Minimal-1503-01.iso.



Windows: You will need to use a program like Cygwin. I have another blog post, teaching how to install Cygwin on Windows machines.

Macs and Linux: Your terminal will have the command already as a part of the machine.



I will show the steps being done on a Windows 10 machine with Cygwin already installed on the computer. If you use a Mac or Linux, the terminal will be able to do the same commands. First, we will download CentOS-7-x86_64-Minimal-1503-01.iso. This method should work with any CentOS minimal instance version 6.5 and greater. I have downloaded the minimal ISO inside:


Open Cygwin as an Administrator and change directory into this folder.

cd C:/Users/huyle/Desktop/ISOs

First, let’s check what /dev/sd removable devices we have. Type ls /dev/sd, don’t press Enter yet, then press the Tab button twice.

ls /dev/sd (Don't press Enter. Press Tab twice to see all the removable drives that start with /dev/sd)

You will see all the sd removable devices.


Now, we will grab our USB Flash Drive. Plug your USB flash drive into your computer or laptop. Now, repeat the ls/dev/sd, then press Tab twice.

ls /dev/sd (Don't press Enter. Press Tab twice to see all the removable drives that start with /dev/sd)



You will see two new removable sd drives. Normally, the new sd drives will be: sdb and sdb1. Keep note of what appears after you plug your USB Flash Drive into the computer or laptop.

Since we are inside the folder where we kept our CentOS-7-x86_64-Minimal-1503-01.iso file. If we type:


We should see the file inside the folder.


Now, we can add the CentOS-7-x86_64-Minimal-1503-01.iso on the USB Flash Drive with the dd command.

dd if=CentOS-7-x86_64-Minimal-1503-01.iso of=/dev/sdb bs=8M


As long as the vertical line is blinking, then you can assume progress is being made. if is set to equal the ISO that you want to create the bootable USB flash drive. of selects the sd removable drive. In this case, we set of equal to /dev/sdb since it was the first /dev/sd that appeared that was new when we plugged our USB flash drive into the computer. bs selects the block size amount.

After a few minutes, the dd command should finish. You should be able to eject your USB flash drive, and boot a computer with the USB flash drive with the CentOS 7 Minimal ISO setup.


Safely eject your USB flash drive, and boot the computer on the USB Storage Device. CentOS 7 Minimal ISO setup will boot immediately afterwards.

How to Check Memory on Linux machines

This article will outline how to check memory on linux and unix based machines. I’ll demonstrate a couple of useful commands that check memory on the hard drive on your machine.

df -h

df -h, which stands for disk free, checks for the space left on the drive in a human friendly format. It’s very useful to see the overall disk space left on the device.

df -h

Screen Shot 2015-08-18 at 9.39.52 PM


du -hs

The opposite of disk free is disk usage. du -hs, which stands for disk usage, checks for the space used on our device in a human friendly format. This command is less useful, but sometimes, instead of needing to look at the summary of memory on the hard drive, we only require looking at the disk space we have already used.

du -hs

Screen Shot 2015-08-18 at 9.36.53 PM


Checking overall memory across drives/partitions

Instead of checking memory on the main partition, you might want to look at the size of memory across all drives and partitions. Here’s where Mac’s and Linux machines differ.

diskutil list

diskutil list checks for the size of drives connected to your Mac.

Screen Shot 2015-08-18 at 11.08.58 PM

sudo fdisk -l

fdisk -l does a similar check like diskutil -l but for Linux machines. You may be prompted for your password because you need sudo user access.

Screenshot from 2015-08-18 23:11:53

How to Use Sublime Text 2 From Terminal on Mac OS

Sublime Text 2? The editor that developers, developers, developers like to use. At the very least, Sublime is a common text editor for the everyday programmer. How can you use Sublime on your terminal? If you’re any programmer, you’re maneuvering through the terminal left and right, all day everyday, so you need to have an easy way to use sublime from the terminal!

By default, for Mac OS X, you don’t have Sublime binded to a command on the terminal! Let’s do show you how to do that.

Installing Sublime

You can install the stable version of Sublime on their website.


How to Set-up

We want to be able to type in:


and open files.

Open a new terminal. First, we will bind the newly installed Sublime 2 (you can also do this for Sublime 3) as the subl command. We’re using a symbolic link from the binary within the Application to what we will make as globally accessible.

sudo ln -s /Applications/Sublime\ Text\ /usr/local/bin/subl

OR you can bind sublime to a sublime command for clarity instead of the abbreviation.

sudo ln -s /Applications/Sublime\ Text\ /usr/local/bin/sublime

The symbolic link will create an accessible subl command to open sublime and use it to open files or folders.

We will open ~/.bash_profile with a text editor and make sure that this new sublime command will be ready whenever we open the terminal.

open -a TextEdit ~/.bash_profile

With .bash_profile, we will set the PATH variable to look inside the /usr/local/bin folder where we created the sublime link. Type the following if it is not in your ~/.bash_profile.

By exporting the path, ~/.bash_profile will refresh and export the folder for accessible binary commands whenever we open a new terminal.

Now save and exit. The first time we do this, we will not have access to the sublime command immediately. We first need to source, which means to reload the ~/.bash_profile in order to have access to our sublime command!

source ~/.bash_profile

How to Use

Open a terminal and use any of the variations of the command:

Open sublime
Open a file
subl file
Open a folder
subl folder/
Open the current directory
subl .

Enjoy your new sublime command! Makes things much more convenient if you enjoy using sublime!

8 Steps to Install Cygwin on Windows

Cygwin provides the Linux feeling on Windows. With Cygwin, you can get a sizable Linux collection of GNU and Open Source tools including a terminal that supports POSIX interface on Windows.

Step 1)

Check whether your System type is 32 bit or 64 bit. If you have Windows 8 or 8.1, right click on This PC on your Desktop, then click on Properties. If you don’t have This PC on your Desktop, you can also use Windows’ search to look for “This PC“, then right click the icon, and click on Properties.

On the Properties of This PC, you can see the System Type underneath System category. For me, System type: 64-bit Operating System, x64-based processor. I have a 64 bit operating system.

Right Click on This PC, Click on Properties, and Look at your System type.


Step 2)

Go to

Select the blue linked executable setup based on your system type of Step 1. Download will start automatically after clicking on one of the blue executable setup links.

Click on the executable setup based on your System type. Download starts automatically.


Step 3)

Open the executable Cygwin setup file. Run the set-up as normal. Click on Next on the Cygwin Setup screen.

When choosing Installation Type, select Install from Internet (default). Click Next.

When choosing the Installation Directory, you can leave the root directory by default, which will be C:\cygwin64 (64 bit). Install for all users. Click Next.

The Local Package Directory contains the setup installation files for packages that you wish Cygwin to have. Underneath Select Local Package Directory, the default is the directory where you have the setup executable.

You can leave this by default.

For Setup your Internet Connection, use Direct Connection for your Internet Connection if you’re using wi-fi or ethernet. Click next.

Choose a Download Site. Select any of the download sites. Click Next.

Cygwin Setup


Step 4)

You’ll now be at Cygwin Setup – Select Packages. From here, you can search for packages that you wish Cygwin to have. The ones that I recommend are:

For each of these packages, they belong to categories. Search for a package. Click on the + next to a category to expand the contents of the search. Click on the circle twirl with the arrows to select the most up-to-date version of that package. Package names are on the right with a short description of that package.

Example of selecting the latest version of nano to install.


Step 5)

After selecting a version to install for all your packages, you can click the next button at the bottom right of the setup screen. At the Resolving Dependencies screen, make sure that the checkbox that says Select required packages (RECOMMENDED) is checked. Click Next. The download and installation of your desired packages will commence.

Resolving Dependencies.


Step 6)

After you finish the download and installation, you can check Create an icon on Desktop. Click Finish. You’ll find a program called Cygwin64 Terminal on your desktop. Open the program. Cygwin is installed.

Installation of packages has finished. Finish.
When you open Cygwin for the first time, Cygwin initializes.


Step 7)

You can also add the Cygwin packages and POSIX interface for the Windows command prompt. In other words, you can make the command prompt act like the terminal in Linux.

Right click on “This PC” and click Properties if it’s on the Desktop. Also, you can use Windows’ search for “This PC” and right click, then click on Properties.

Click on Advanced System Settings in this Properties window.

In the System Properties that pops up, click on Environment Variables, which will be within the Advanced tab. Inside Environment Variables, look underneath the System variables section. Scroll through and look for the Variable with the name Path. Click on that line. Click on the Edit button underneath. For 64 bit, add a “;C:\cygwin64\bin;” to the end of the Variable value line. This allows the command prompt to work with Cygwin’s directory path to the Cygwin’s bin folder and utilize Cygwin’s packages and POSIX interface. Click OK for each of the three windows to save this setting.

Cygwin’s path variable to work with the command prompt.


Step 8)

Open a command prompt. You can use Windows’ search and search for command prompt or cmd. Click on command prompt, and a command prompt black box will open. You will have all the functionality of Cygwin within the command prompt. You can choose to use either Cygwin or a command prompt to use the linux tools or POSIX interface.

Displaying SSH on a Windows command prompt.