linux 移动文件
时间: 2024-01-10 12:02:20 浏览: 68
要在 Linux 中移动文件,可以使用 `mv` 命令。`mv` 命令可以将一个文件或目录移动到新位置或重命名。
例如,要将名为 file.txt 的文件移动到 /home/user 目录下,可以使用以下命令:
```
mv file.txt /home/user
```
如果要将文件重命名为 newfile.txt 并将其移动到 /home/user 目录下,可以使用以下命令:
```
mv file.txt /home/user/newfile.txt
```
请注意,如果在目标目录中已经存在同名文件,则会被覆盖。如果您希望保留原文件并在目标目录下创建一个副本,请使用 `-n` 选项:
```
mv -n file.txt /home/user/
```
这将在 /home/user 目录中创建一个名为 file.txt 的副本,而不覆盖任何现有文件。
阅读全文
相关推荐














