Is is possible to transfer files from local machine to server using FTP and terminal. For instance, can I create a file locally with vim, write my code, save it, then transfer that to a server without using something like Transmit, Filezilla, or Forklift?
2 Answers
You can even do that from within Vim! The netrw plugin ships with it and is enabled by default. One way to access remote files is by prefixing the filespec with the protocol, like this:
:w ftp://hostname/path/to/file
You can find out more about this via :help pi_netrw
. Of course, you still need to have an FTP (SSH, ...) client on your system, and need to provide the credentials as well, so everything in @Gytis's answer still applies.
Assuming that FTP is enabled on your server you can use plain TCP/IP FTP connection. Interactively something like ftp username@server
should work. user username
once connected will let you login with a specific user if anonymous connections are disallowed or lack privileges. cd
,ls
and put
would be your basic commands once logged in to upload files. The man pages will give you a lot more information on the more advanced commands and settings.If you have ssh working on your local machine and server then you can use SFTP. Commands are largely the same and would be something along the lines of sftp user@server
and put filename
. May want to cd
to correct directory before putting the file. Secure copy would also work if your target server is *nix based. i.e. scp /file/to/move/file.txt username@server:/path/to/destination
. Scp has -i option to specify your ssh key if that's how you connect to the server
-
3
-
You're right, should've read through the question more thoroughly. Updated the answer to better reflect the question– GytisAug 21, 2018 at 11:21