常用文件命令#
删除文件#
rm <file_name>
# 删除文件夹及内的文件
rm -r <folder_name>bash移动文件#
mv <source_file> <destination_file>bash复制文件#
cp <source_file> <destination_file>
# 复制文件夹及内的文件
cp -r <source_folder> <destination_folder>bash文件链接#
# 创建软链接
ln -s <source_file> <link_file>
# 创建硬链接
ln <source_file> <link_file>bash下载/传输文件#
从互联网下载文件#
wget 命令#
wget 是一个非交互式的网络下载工具,简单易用,支持 HTTP、HTTPS 和 FTP。
以下是您提供的 wget 命令选项的 Markdown 表格:
| 选项 | 说明 | 示例 |
|---|---|---|
-O <文件名> | 指定保存文件名 | wget -O myfile.zip https://example.com/file.zip |
-P <目录> | 指定下载目录 | wget -P ~/downloads https://example.com/file.zip |
-c | 断点续传 | wget -c https://example.com/bigfile.iso |
-b | 后台下载 | wget -b https://example.com/largefile.mp4 |
--limit-rate=<速度> | 限速下载 | wget --limit-rate=200k https://example.com/file.iso |
-t <次数> | 设置重试次数 | wget -t 5 https://example.com/unstable.file |
--timeout=<秒> | 设置超时时间 | wget --timeout=30 https://example.com/slow.file |
-r | 递归下载 | wget -r https://example.com/directory/ |
-l <深度> | 设置递归深度 | wget -r -l 2 https://example.com/ |
-np | 不追溯至父目录 | wget -r -np https://example.com/path/ |
与远程计算机交换文件#
scp 是一个用于复制文件或目录的命令行工具,它可以在远程计算机之间进行文件传输。
scp <local_file> <username>@<remote_host>:<remote_path>
scp <username>@<remote_host>:<remote_file> <local_path>
scp -r <local_directory> <username>@<remote_host>:<remote_path>
scp -r <username>@<remote_host>:<remote_directory> <local_path>bashrsync是一个用于同步文件或目录的命令行工具,它比 scp 更加高效,并且支持增量传输,因此它可以在文件或目录大小变化时快速传输。
下载网盘中文件#
百度网盘 - bypy#
bypy 是一个Python命令行工具,它允许你无缝地与百度网盘交互,提供了一种简单且高效的方式来进行文件上传、下载、管理等操作。
安装
pip install bypybash登录
执行 bypy info ,按照提示操作。
下载
# 下载文件
bypy downfile <remotefile> <localpath>
# 下载文件夹
bypy downdir <remotefolder> <localpath>
# 使用下载器
bypy --downloader aria2 download <remotefile> <localpath>bash文件处理#
解压文件#
unzip 命令用于解压 zip 文件。
unzip <zip_file>bash