Using curl to access an ftp serverlinux tech
When I’ve been spinning up new VMs recently I’ve found that ftp isn’t installed by default on minimal set-ups, but I’ve had to access an ftp server in order to get archive files and the like.
So, while it is pretty easy to install ftp, I’ve found out that you can do most stuff I need via curl. This is pretty handy, and curl gives more information about the download (‘get’) progress.
If you know the exact path to the file you want to download (I’m only looking at downloading for now), then this is all you need:
$ curl -O 'ftp://username:firstname.lastname@example.org/path/to/myfile'
This is great but sometimes I need to work out where the file I need is on the server, so do I still need ftp?
No – curl can handle this for you too:
$ curl 'ftp://username:email@example.com/'
Note that you need the trailing slash ‘/’ to get an ‘ls -l’ style list, also drop the ‘-O’ parameter.