Book Image

Troubleshooting CentOS

By : Jonathan Hobson
Book Image

Troubleshooting CentOS

By: Jonathan Hobson

Overview of this book

Table of Contents (17 chapters)
Troubleshooting CentOS
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Using cURL to access an FTP directory


With practice, everyone can use an FTP client, but a situation where you need to script certain events is where you will call on cURL to do all the hard work.

So, by starting at the most basic level, the easiest way to access an FTP directory with an existing username and password will be as follows:

$ curl ftp://exampleftpsite.com -u <username>

When requested, simply enter your password at the prompt:

$ curl ftp://exampleftpsite.com  -u <username>
Enter host password for user '<username>':

Now, if you want to search an FTP directory for a particular list of files, you can use the -s silent option and grep in combination like this:

$ curl ftp://exampleftpsite.com -u <username> -s | grep <keyword>

You can complete your search and upload a file with the following command:

$ curl -T filename.zip ftp://exampleftpsite.com -u <username>

Or you can make a direct download with the following syntax:

$ curl ftp://exampleftpsite...