WinSCP How to create a Symlink

What is a Symlink?

Symlinks (Symbolic Links) are also known as Soft links, and they are widely used on Linux, as well as in other OS, in Windows they are called “shortcuts”, basically they are just small files acting as links to an actual file, you can have as many symlinks as needed and removing them doesn’t affect the actual file.

Softlink vs Hardlink

The following image shows a graphical representation of both the softlink vs the hardlink.

Main differences between Softlink and Hardlink are listed in the following image.

Sites-Available vs Sites-Enabled

One common use case of Symlinks is on web servers, I’ve come across with Debian based distros (Ubuntu) running either Apache or Nginx as web servers and both using a particular scheme to activate websites using the Sites-Available and Sites-Enabled model.

NGINX Sites-Available and Sites-Enabled

Under that model you can have several websites but only a few of them being served, that is quite useful if you have a website under development or just a website acting as backup.

How to create a Symlink using WinSCP

The first thing you have to get when creating a Symlink in this case to enable a website under the Debian scheme is the path to the actual file, that is the link to the Virtual Host configuration file, in our example that file is called “website-example”.

Obtaining the path to the file is really an easy task using the WinSCP GUI, see image below.

WinSCP – getting the file path

If you want to speed up this step, then you can make use of the key combination Ctrl+Alt+C, once you have the path on the clipboard you can go to the folder “sites-enabled” to create the Symlink, just right click and select “New/Link“, see screenshot below.

WinSCP creating a new Symlink

Paste the file path and also the file name as follow.

WinSCP creating a new Symlink – file name and file path

That’s it your brand new Symlink has been successfully created.

How to create a Symlink using the CLI

Those of you who prefer doing things purely and always on the terminal can use the following CLI when creating Symlinks.

ln -s /etc/nginx/sites-available/website-example /etc/nginx/sites-enabled/website-example

Where to go next?

In case you want to go further on learning about WinSCP and its multiple useful tool you can take a look at the following articles.