Sublime Text is a popular code editor for web development. The developers are preferred using this editor. Its simplicity, rich snippets provide a good experience for the developers. The Sublime Text comes with a lot of useful features which 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 reliable.
As a programmer, we always do the job of file transfer, move a local project on the remote server. Filezilla is popular software that allows us to transfer files from a local server to a remote server and vice-versa. We can also use cPanel provided by the hosting service for uploading or downloading files.
Similar to Filezilla and cPanel we can use Sublime Text for uploading files on a server. Sublime Text provides a package called ‘SFTP’ which does a file transfer to the remote server and much more.
In this article, we will discuss the ‘SFTP’ package. It allows you to transfer or download files from local to a remote server(and vice-versa). The best thing is these file operations can be managed from within the editor itself. You don’t need any third-party software like FileZilla, WinSCP, etc.
Sublime Text Package Control Installation
In order to get started, you first need to install ‘Package Control’ in Sublime Text. This installation page explains the steps for installing the ‘Package Control’. There are 2 ways you can install ‘Package Control’.
Install Package Control using Command Palette
- Open the Sublime Text and then command palette. To open the command palette, type
ctrl+shift+pfor Windows/Linux OS and
- Type ‘Install Package Control’ and then press Enter.
Install Package Control From Menu
- Click on the ‘Tools’ menu.
- Select ‘Install Package Control’.
Upon installing Package Control, you will able to install packages available for the Sublime Text.
How to Install SFTP Package
Installing the ‘SFTP’ package requires just a few steps. In the Sublime Text, for installing packages you don’t need to go outside. The packages can be installed within the editor itself.
ctrl+shift+p on Windows and Linux, and
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 till it loads the repositories.
Type SFTP and you will see the SFTP package. Select the SFTP box and hit Enter.
After hitting Enter, Sublime Text will install the SFTP package for you.
How to Use SFTP Package
To use the SFTP package, make sure the files/directory structure of the local and remote server is the same. When you are uploading any file it will search for the same location on the remote server and perform the operation.
Open your local project in the Sublime Text. You can do this by going to Project->Add Folder to Project and then browse your project directory. Once done you need to set up the SFTP/FTP server for your project. Head over to File->SFTP/FTP->Setup Server.
It will open a file where you need to fill your server details.
Add the details of your server in the file and save this file as
sftp-config.json in the root of your project directory.
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. See all available options by ‘Right Click->SFTP/FTP’. Make sure you are doing these operations carefully as it will affect directly on 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.
Like upload, the package gives much more to perform. You can give it a try for each option. You may read more about it on their documentation.
- FTP/SFTP Extension for Visual Studio Code
- How to Upload Images to Another Server Through FTP in Laravel
- Upload Files to Amazon S3 Using AWS PHP SDK
If you liked this article, then please subscribe to our YouTube Channel for video tutorials.