How to Use FTP/SFTP Package with Sublime Text

Sublime Text is a popular code editor among software developers. It’s simplicity and rich snippets provide a good experience for the developers. Sublime Text comes with a lot of useful features that make the developer’s life easy. One of the important features of this IDE is ‘Packages’. There are several packages available that help us to make the development process fast and efficient. These packages perform certain tasks that are needed during development.

As a programmer, we always do the file transfer and move a local project to the remote server. Software like Filezilla allows us to transfer files from a local server to a remote server and vice-versa. We may also use the hosting cPanel for uploading and downloading files.

Similar to Filezilla and cPanel we can use Sublime Text for file transfers on a server. Sublime Text provides a package called ‘SFTP’ which transfers files to the remote server, downloads files from a remote server and much more. The best thing about this package is file operations can be managed from within the editor itself. You don’t need any third-party software like FileZilla, WinSCP, etc.

Having said that let’s see how to use the SFTP package with Sublime Text.

Package Control Installation in Sublime Text

To get started, you first need to install ‘Package Control’ in Sublime Text. There are 2 ways to install the ‘Package Control’.

Install Package Control using Command Palette

  • Open the Sublime Text and then the command palette. To open the command palette, type ctrl+shift+p for Windows/Linux OS and cmd+shift+p for macOS.
  • Type ‘Install Package Control’ and press Enter.

Install Package Control From Menu

  • Click on the ‘Tools’ menu.
  • Select ‘Install Package Control’.

You’ll also find the above steps in this installation guide. Upon installing Package Control, you will able to install different packages for the Sublime Text.

How to Install SFTP Package

Installing the ‘SFTP’ package requires just a few steps. In Sublime Text, the packages are installed within the editor itself.

Press the ctrl+shift+p on Windows and Linux, cmd+shift+p on macOS and type Package Control. Select ‘Package Control: Install Package’, it will populate the packages. You may need to wait for a while until the editor loads the repositories.

install-package

Type SFTP and you will see the SFTP package. Select the SFTP box and hit Enter.

sftp

After hitting Enter, Sublime Text will install the SFTP package for you.

How to Use SFTP Package

To use the SFTP package, make sure you have the same directory structure for the local and remote server. When you are uploading a file, it will search for the same location on the remote server and perform the operation.

Let’s see it in action. Open your local project in Sublime Text. You can do this by going to Project->Add Folder to Project and then browsing your project directory. After this, you need to set up the SFTP/FTP server for your project. Head over to File->SFTP/FTP->Setup Server.

sftp-setup-server

It will open a file where you need to fill in your server details.

add-details

Add your server details to this file and save it as sftp-config.json in the root directory of your project. Here, you can add comments(//) to the password pair. The package will ask for a password during file operations.

You are now ready to take the benefits of the ‘SFTP’ package. The user can easily perform their preferred operation with just a few clicks. Check out all available options by ‘Right Click->SFTP/FTP’. Make sure you are doing these operations carefully as it will affect directly a remote server.

Let’s say you want to upload a file on a remote server. Open that file in the editor and do the ‘Right Click->SFTP/FTP->Upload File’. It will transfer your local file to a remote server.

upload-file

You’ll get the log of each operation at the bottom of the editor. Like upload, the package gives much more options to perform. You can try every option one by one. Read more about the SFTP package in their documentation.

Related Articles

If you liked this article, then please subscribe to our YouTube Channel for video tutorials.

7 thoughts on “How to Use FTP/SFTP Package with Sublime Text

Leave a Reply

Your email address will not be published. Required fields are marked *