Skip to main content

Download entire website via FTP with a single line command

Jose CerrejonAbout 1 minRaspberry PILinuxRaspberry PILinux

Download entire website via FTP with a single line command


Getting out a little from the standard pattern, I tell you that yesterday I needed to back up the blog, hosted on 1and1open in new window. The trouble is that the only way to do this is by FTP. So as I make copies every Friday, I show how you can download your blog with lftp or wget with a single line without flinching. Want to see it?...

It's not the first time I talk with some of my clients or friends and they forgot to make backups of the blog. They think it will work as long as the disaster by either hosting or hacking exploiting vulnerability arrives: Everyone gets nervous and can not remember when was the last time they made a backup.

[ LFTP ]

LFTPopen in new window is a ftp/http client that support ftp, ftps, http, https, hftp protocols. It's a common package in any distribution and if you have not installed, you simply type sudo apt-get install lftp

To make a remote backup, simply type the following:

lftp -e 'mirror / /path/' -u user,password website

Example: lftp -e 'mirror / /home/john/my_backup/' -u johnftp,rpi43v3r\!

NOTE: The password, if you use characters like !, must be preceded by a backslash \

[ Wget ]

Not a day that does not use this command on my daily chores. Here to download this blog:

wget -q -P /url/path/ -r ftp://user:passwd@website

Example: wget -b -P /home/john/ -r ftp://johnftp:rpi43v3r!


  • Argument -b causes the files to be copied in the background and generate a log, although we could have used -q for not show the exit.

  • wget is a little faster than lftp.

Link: > LFTP Cheatsheetopen in new window

Link: > Using wget to download select directories from ftp serveropen in new window