Moving Files In Linux - page 2
The Low Security Family
The lftp tool can handle six different methods of file transfer (see the man page for the full list), including FTP and HTTP as well as the option of OpenSSL-based secure methods if they were included when the program was compiled. You can feed this tool instructions through a single command line, interactively, or even through a script file.
For an example, we'll teach lftp to grab the whole set of HOWTOs from the Linux Documentation Project's server. Since we're not psychic (or at least I'm not), we'll walk through by hand before trying to write a script or do a nice long command line, so start by typing:
As a result, you'll get the prompt:
lftp isn't actually sitting there connected to the server. There's no
need to connect until you actually send a request. Now, if we type
we'll see a prompt saying that lftp is looking up the name and accessing
the server, and then something similar to what's shown in Figure 1.
Rather than going through the tedious step by step of figuring out what
directories to go to, we've all been through it with FTP, I've already
looked to see where I want to go. I'll skip straight to the directory
/pub/Linux/docs/HOWTO by typing
cd /pub/Linux/docs/HOWTO. lftp
connects for a moment to verify that the directory exists, and then
changes to that directory.
Now, I don't want every HOWTO individually. I just want the .tar.bz2
file for the full HOWTO set, and after this I can have the cron program
use lftp to see if there's a newer version available, and grab it. If I
ls *bz2 only one file is listed (the number will change according
to the date):
lftp www.tldp.org:/pub/Linux/docs/HOWTO> ls *bz2 -rw-rw-r-- 1 gferg linux 5699858 Feb 27 05:00 Linux-HOWTOs-20030227.tar.bz2 lftp www.tldp.org:/pub/Linux/docs/HOWTO>
I want to download this file to my ~/Downloads/documents directory, so I
lcd ~/Downloads/documents to change directories on my host
lftp www.tldp.org:/pub/Linux/docs/HOWTO> lcd ~/Downloads lcd ok, local cwd=/home/dee/Downloads lftp www.tldp.org:/pub/Linux/docs/HOWTO>
Now I type
get Linux-HOWTOs-20030227.tar.bz2 and let lftp grab the
first copy for me. Then I type
exit to close the lftp prompt. After
doing the walk-through like this, I could then turn around and write the
necessary lftp script, and add it to my crontab scheduler.
This is where lftp is at its most useful, where you don't care if
someone sniffs the content because you're just doing an anonymous FTP
login and grabbing publicly accessible files. The moment you start
needing to worry about passwords being sniffed, or file contents, then
lftp isn't a good choice--unless you're using a version with OpenSSL
compiled in and make sure to only use it for FTPS and HTTPS (secure)
Solid state disks (SSDs) made a splash in consumer technology, and now the technology has its eyes on the enterprise storage market. Download this eBook to see what SSDs can do for your infrastructure and review the pros and cons of this potentially game-changing storage technology.
- 1Linux Top 3: GNOME 3.12 and New Betas for Ubuntu 14.04 and OpenMandriva Lx 2014.0
- 2Linux Top 3: Linus Lashes out, Linux 3.14 Gets PIE and Ubuntu One is Done.
- 3Linux Top 3: Ubuntu 14.04, Debian Gives Squeeze More Life and Red Hat Goes Atomic
- 4Linux Top 3: CoreOS, Oracle Enterprise Linux 7 and Ubuntu 14.10
- 5Linux Top 3: Linux from Scratch, Ubuntu 14.01 Beta and Arch Updates