01
写在前面
02
scp联通的不同的主机传输文件
scp 与 cp 的区别是,cp 用于在 linux 本机下拷贝文件到其他路径。scp 的原理其实是使用 ssh 协议登陆到 linux 服务器,然后传输文件。ssh 协议可以使用用户名和密码登陆Linux,也可以使用用户名和密钥来登陆。
COPYssh user@host -p port (需要输入密码)ssh user@host -p port -i xx.pem (使用密钥进行认证)# 使用 scp 拷贝文件时使用的命令与 ssh 是类似的。scp -P port user@host:/tmp/xiyou.txt . (将远程主机的 /tmp/xiyou.txt 文件拷贝到本机的当前工作目录,这里"."表示当前目录,需要输入密码)scp -r -P port user@host:/tmp/ . (复制远程主机上的目录到本机的当前工作目录) scp -i xx.pem -P port user@host:/tmp/xiyou.txt . (使用秘钥 xx.pem 的方式认证,不需要输入密码,秘钥需要提前生成)# 将本地的文件拷贝到远程主机上:scp -P port user@host:/tmp xiyou.txt03
wget用于从网络中下载文件
# 下载链接中的图片 https://mirrors.tuna.tsinghua.edu.cn/static/img/logo-small-dark.png 并存储为 tuna.pngwget -O tuna.png "https://mirrors.tuna.tsinghua.edu.cn/static/img/logo-small-dark.png"ls -la | grep tuna.png# 下载一个文件,不指定文件名wget https://mirrors.tuna.tsinghua.edu.cn/docker-ce/linux/ubuntu/gpgls -la | grep gpg# 查看 wget 其他参数的使用方法wget --help# -c 参数支持断点续传,这在传输大文件时十分有用wget -c -O tuna2.png https://mirrors.tuna.tsinghua.edu.cn/static/img/logo-small-dark.png04
mwget
mwget 是 wget 的升级版,支持多线程,下载速度更快。安装方式如下:
COPY# 安装编译依赖sudo apt updatesudo apt install build-essential -ysudo apt upgrade intltool -ysudo apt install libssl-dev -y# 编译git clone https://github.com/rayylee/mwget.gitcd mwget./configuresudo make && sudo make install# 查看使用方法mwget --helpmwget https://mirrors.tuna.tsinghua.edu.cn/docker-ce/linux/ubuntu/gpg05
curl通常用来在终端中模拟浏览器访问网站
curl 也可以用来下载文件,不过使用体验不如 wget。
COPY# 使用 curl 下载链接中的文件,并保存为 tuna3.pngcurl -o tuna3.png https://mirrors.tuna.tsinghua.edu.cn/static/img/logo-small-dark.png# 查看 curl 的其他用法curl --help06
rsync
参考链接:https://www.ruanyifeng.com/blog/2020/08/rsync.html
COPY# 使用 2234 端口,将本地的 source 目录拷贝到远程机的 /destination 目录rsync -av -e 'ssh -p 2234' source/ user@remote_host:/destination
如何联系我们


已有生信基地联系方式的同学无需重复添加

