SFTP is a FTP like file transferring protocol with additional security measures. Additional security measures put in place by connecting through SSH. You can log in to the SFTP server through command line and upload, download manage files in an interactive way. SFTP has been integrated to many GUI also (WinSCP, Filezilla, FireFTP etc). In this article, I’m going to discuss few useful SFTP commands which you will use often.
How to Connect
You can connect to the SFTP by this command using the default port (22)
If you are using a custom port, bellow command will help to connect.
SFTP -P [port] [sftp_user_name]@[server_ip/server_name]
Few Important SFTP Commands
You can issue regular linux commands to run it on remote server and the regular commands with prefix ‘l’ to run it on local machine. I have listed few of them which you will be frequently using.
|? / help||List all the available commands|
|cd||Change directory (remote)|
|lcd||Change directory (local)|
|pwd||Showing present working directory (remote)|
|lpwd||Showing present working directory (local)|
|ls||Listing files (remote)|
|lls||Listing files (local)|
|put [file name]||Upload file from local to remote|
|mput [pattern].ext||Upload files following similar naming pattern |
or same extension.
|get [file name]||Download file from remote server to local.|
|mkdir [dir name]||Creating a directory on remote|
|mkdir [dir name]||Creating a directory on local|
|!||Exit from the sftp command line.|
SFTP is a simple tool. But this can be securely used to administrating servers and for file transferring. Hope this article helped you to get a rough idea and essential knowledge to manage your SFTP with console.