Linux 服务器上传文件到阿里网盘

1. 下载阿里网盘安装包

查看系统架构

(base) work@instance-cli0crch:~$ dpkg --print-architecture 
amd64

参考链接:https://blog.csdn.net/weixin_41010198/article/details/109166131

根据服务器架构选择要下载的压缩包:

https://github.com/tickstep/aliyunpan/releases
1)arm / armv5 / armv7 : 适用32位ARM系统
2)arm64 : 适用64位ARM系统
3)386 / x86 : 适用32系统,包括Intel和AMD的CPU系统
4)amd64 / x64 : 适用64位系统,包括Intel和AMD的CPU系统
5)mips : 适用MIPS指令集的CPU,例如国产龙芯CPU
6)macOS amd64适用Intel CPU的机器,macOS arm64目前主要是适用苹果M1芯片的机器
7)iOS arm64适用iPhone手机,并且必须是越狱的手机才能正常运行

我使用的命令如下:

(base) work@instance-cli0crch:~$  wget https://github.com/tickstep/aliyunpan/releases/download/v0.1.8/aliyunpan-v0.1.8-linux-amd64.zip

2. 解压压缩包

(base) work@instance-cli0crch:~$ unzip aliyunpan-v0.1.8-linux-amd64.zip

3. 登录网盘

(base) work@instance-cli0crch:~$ cd aliyunpan-v0.1.8-linux-amd64/
(base) work@instance-cli0crch:~$ ./aliyunpan
aliyunpan > login
请输入RefreshToken, 回车键提交 > 

找到 RefreshToken

任意打开浏览器,在网页中登录阿里网盘,然后 F12,依次点击 ApplicationLocal Storagetokenrefresh_token 找到 RefreshToken:
在这里插入图片描述

4. 上传文件

aliyunpan > upload <本地文件/目录的路径1> <文件/目录2> <文件/目录3> ... <目标目录>

5.退出

aliyunpan> logout

参考链接:http://www.360doc6.net/wxarticlenew/1027857656.html

### 使用 `scp` 或 `rsync` 将本地文件上传Linux 服务器 #### 使用 `scp` 命令 `scp` 是一种基于 SSH 协议的安全复制工具,适用于在不同主机间传输文件。对于从本地向远程服务器发送文件的操作如下所示: ```bash scp /path/to/local/file remote_user@remote_host:/path/to/destination/ ``` 例如,如果希望把名为 `example.txt` 的文档传送到 IP 地址为 `192.168.1.1` 的机器上 `/home/user/documents/` 文件夹内,则应执行下面这条指令[^1]。 ```bash scp ~/Documents/example.txt user@192.168.1.1:/home/user/Documents/ ``` 当涉及到特定端口时,可以利用 `-P` 参数指定目标主机上的SSH服务监听端口: ```bash scp -P port_number /path/to/local/file remote_user@remote_host:/path/to/destination/ ``` 比如要通过非默认端口 (假设是2222) 进行连接并传送相同文件的话,那么命令应该是这样的形式[^2]: ```bash scp -P 2222 ~/Documents/example.txt user@192.168.1.1:/home/user/Documents/ ``` #### 使用 `rsync` 命令 虽然 `rsync` 主要是用来同步数据而不是简单的复制操作,但它同样支持跨网络的数据迁移工作。其基本语法结构类似于 `scp`, 不过提供了更多的选项来优化性能以及处理增量更新等问题。以下是使用 `rsync` 向远端推送文件的例子: ```bash rsync -avz --progress /path/to/local/file remote_user@remote_host:/path/to/destination/ ``` 这里参数解释: - `-a`: 归档模式,表示递归传输并且保持原有属性; - `-v`: 显示详细信息; - `-z`: 对传输中的数据流启用压缩功能以减少带宽占用; - `--progress`: 展示进度条以便观察当前状态; 同样的,在需要指明自定义端口的情况下,可以通过设置环境变量或者直接加入额外的标志位完成配置: ```bash RSYNC_PORT=port_number rsync -avz --progress /path/to/local/file remote_user@remote_host:/path/to/destination/ # 或者也可以这样写 rsync -e 'ssh -p port_number' -avz --progress /path/to/local/file remote_user@remote_host:/path/to/destination/ ```
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

悄悄地努力

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值