wget, 服务器上的"迅雷"
当我们想从网络上, 或者公司局域网内获取程序包时, 一般会先下载到本地, 再从本地上传到自己的服务器
不仅麻烦, 而且还存在二次传输, 速度慢
使用wget
, 可以一步到位, 省时省力
1. FTP/HTTP下载, 并提供用户名密码
wget --user=xxx --ask-password ftp://ftp.example.com/aaa/bbb/ccc/ddd.tgz
wget --user=xxx --password=yourpassword ftp://ftp.example.com/aaa/bbb/ccc/ddd.tgz
--user=user
--password=password
Specify the username user and password password for both FTP and HTTP file retrieval. These parameters can be overridden using the
--ftp-user and --ftp-password options for FTP connections and the --http-user and --http-password options for HTTP connections.--ask-password
Prompt for a password for each connection established. Cannot be specified when --password is being used, because they are mutually
exclusive.
2. 批量下载
wget -r -nd --user=xxx --ask-password ftp://ftp.example.com/aaa/bbb/ccc
-r
--recursive
Turn on recursive retrieving. The default maximum depth is 5.-l depth
--level=depth
Specify recursion maximum depth level depth.-nd
--no-directories
Do not create a hierarchy of directories when retrieving recursively. With this option turned on, all files will get saved to the current
directory, without clobbering (if a name shows up more than once, the filenames will get extensions .n).