Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Linux Timesaving Techniques For Dummies.pdf
Скачиваний:
59
Добавлен:
15.03.2015
Размер:
15.98 Mб
Скачать

Downloading and Uploading with curl

93

The preceding command limits the download rate to 20 kilobytes per second — a very generous gesture if you’re sharing a network link.

If you use a proxy server to connect to the Internet, wget can use it, too. wget uses the $http_proxy environment variable to find your proxy server. Enter the command

$ export http_proxy proxyaddress:port at the command line to set the environment variable. Add this environment variable to your bash startup script to run the command each time you log in.

Downloading and Uploading with curl

curl (a client for URL) works with the HTTP and FTP protocols to download or upload files. curl is an easy way to upload files when you’re maintaining a Web site, or to keep files synchronized with the work of remote employees.

curl is a powerful download tool, too. For more information about the features of curl, type man curl at the command line.

When you upload with ftp, you have to drive the entire process. You have to enter passwords, type in the put commands one at a time, and disconnect when you’re finished. Unlike ftp, curl can do its

job without additional user input. You can also schedule curl to do large uploads when the network is quietest — you’ll get the best throughput and provide the least aggravation to other users.

To upload a file with curl, enter this command:

$ curl -T uploadfile ftp://ftp.sitename.com/filename

Replace uploadfile with your local filename and substitute the ftp sitename information into the command, and the file is on its way. That’s all there is to it.

Set up an ftp server where remote employees’ can save their work. Schedule a nightly job on the remote employees’ machines to keep up- to-date with their important files — and they won’t have to babysit the upload!

If you create an ftp server to hold your employees’ nightly updates, you’ll want that server to be secure. To use curl to upload a file to a secure site, use the following command:

$curl -T uploadfile -u user:passwd ftp://ftp.sitename.com/filename

curl gives you the option to update single files, multiple files, or entire systems with a single command. When you combine the powerful uploads that you can get with curl with the scheduling features of Task Scheduler, you’ll find lots of ways to save time!

Visit the CURL Web site at curl.haxx.se for a complete overview of the curl project.

The basics of URL syntax

Have you ever wondered what that string of characters you type into your Web browser is made of?

A simple address like http://www.wiley.com tells the browser to use the http protocol to connect to a host named wiley.com.

A more complex address like http://www.wiley.com/ newbooks.html tells your browser to open the newbooks. html resource at the host wiley.com.

An ftp URL often contains a user name and password for the ftp server. The address ftp://freddie:FuNkY@ bastille/mixers.html tells ftp that the user freddie, with a password of FuNkY, wants to log into bastille to access the resource mixers.html.

15 Building a Playpen

with User Mode

Technique Linux

Save Time By

Creating a virtual work environment with User Mode Linux

Using ADIOS to set up a Fedora VM

Using graphical interfaces to your advantage in server management

Making permanent changes to your virtual machine

Sometimes, you could really use a second computer — someplace safe and secure to hold a server or to try out some new software. Are you interested in trying the latest features in the Linux kernel,

but you’re stuck with version 2.4 for a while? User Mode Linux (UML) is what you’re looking for.

User Mode Linux is a virtual machine (VM) — which is just like a regular computer, but it’s built entirely of software. The physical computer that contains the VM is called the host. The host and the virtual machine can share resources such as files, disk drives, and network interfaces.

With UML, you can even simulate hardware that you don’t have. If you have a single Linux computer, you can run two or three UML sessions to simulate a local area network. You can try out new kernels while safeguarding your real work on a familiar kernel. You can also use UML to create jails for hack-vulnerable programs (such as Apache or DNS servers). A jail is an environment that confines a dangerous program by limiting access to important files and devices that the program doesn’t need (and more importantly, shouldn’t damage).

In this technique, we show you how to install a UML system based on the Fedora Core distribution. This technique is one you can really build on. After you’ve installed a virtual machine, you can jump ahead to Technique 24 to find out how to build a new kernel and try it out in a safe environment before you install it, or you can skip ahead to Technique 58 to create a UML jail.

Choosing the ADIOS Version

of User Mode Linux

You can download, compile, and install UML by hand, but we know a much quicker way thanks to the nice folks at the Queensland University of Technology in Brisbane, Australia. They have put together a package named ADIOS that makes it easy to install UML, loaded with a Fedora

Соседние файлы в предмете Операционные системы