Getting Started With NCFTP
Using a command line tool to open a remote server and download or upload files.
As I’m being brough on to a new project, I will need to connect to the remote site using ftp in order to download source files, and upload them when I’m finished. For this, I will be using NCFTP.
Introduction to NCFTP
From NCFTP manual:
The purpose of ncftp is to provide a powerful and flexible interface to the Internet standard File Transfer Protocol.
First, download NCFTP by using your Linux software manager. Other installation options from command line can be found here.
Right now, I need to open a remote connection and download a remote file. Then I want to update the file and make sure I can upload it once it’s been changed.
Step 1 — Change into the local directory where you want the files to download.
In my case, this was the root directory /var/www/classlete, but you can choose whatever you want.
Step 2 — Start NCFTP
If you are on Linux, you will need to sign in as the superuser before running NCFTP. This will give you authorisation to access the remote. Then begin the NCFTP program from the command line.
Step 3 — Open remote FTP
Once ncftp starts, you should be presented with a prompt. From here, you can type “help” to get a list of commands to get help for. In our case we want to use “open”. Most likely, you will require a username and password to access the remote server, so we will use the -u and -p flags as well as the IP address we would like to open:
$ open -u username -p password xx.xxx.xxx.xx
Step 4 — Use get command to download files
Now that the open command is successful, you will be able to navigate through the file system. Find a file like a simple text file to try downloading first. The command we will use to download into the current local directory (the one we were in when we started ncftp) is called “get”.
$ get robots.txt
Step 5 — Quit NCFTP and edit the file
You can quit NCFTP by entering “quit”. Edit the file then go back to ncftp and open the remote again.
Step 6 — Use put to upload a file
The command we need to use is called “put”. Make sure you are in the correct remote directory and then use this command:
$ put robots.txt
You will receive a notification that the file is updated and you are done!