Rinne's Blog

Back

常用文件命令#

删除文件#

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>
bash

rsync是一个用于同步文件或目录的命令行工具,它比 scp 更加高效,并且支持增量传输,因此它可以在文件或目录大小变化时快速传输。

下载网盘中文件#

百度网盘 - bypy#

bypy 是一个Python命令行工具,它允许你无缝地与百度网盘交互,提供了一种简单且高效的方式来进行文件上传、下载、管理等操作。

安装

pip install bypy
bash

登录

执行 bypy info ,按照提示操作。

下载

# 下载文件
bypy downfile <remotefile> <localpath>
# 下载文件夹
bypy downdir <remotefolder> <localpath>
# 使用下载器
bypy --downloader aria2 download <remotefile> <localpath>
bash

文件处理#

解压文件#

unzip 命令用于解压 zip 文件。

unzip <zip_file>
bash
©
Linux 使用笔记:文件操作
https://astro-pure.js.org/blog/technology/linux-notes/file-operate
Author Rinne
Published at 2025年10月12日
Comment seems to stuck. Try to refresh?✨