From 50a49e2b8503e8c7fe59e3f19360521b61b28801 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Thu, 5 Aug 2021 05:03:52 +0800 Subject: [PATCH] =?UTF-8?q?=E9=80=89=E9=A2=98[tech]:=2020210804=20Move=20f?= =?UTF-8?q?iles=20in=20the=20Linux=20terminal?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20210804 Move files in the Linux terminal.md --- ...210804 Move files in the Linux terminal.md | 52 +++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 sources/tech/20210804 Move files in the Linux terminal.md diff --git a/sources/tech/20210804 Move files in the Linux terminal.md b/sources/tech/20210804 Move files in the Linux terminal.md new file mode 100644 index 0000000000..3e2a61b7c7 --- /dev/null +++ b/sources/tech/20210804 Move files in the Linux terminal.md @@ -0,0 +1,52 @@ +[#]: subject: "Move files in the Linux terminal" +[#]: via: "https://opensource.com/article/21/8/move-files-linux" +[#]: author: "Seth Kenlon https://opensource.com/users/seth" +[#]: collector: "lujun9972" +[#]: translator: " " +[#]: reviewer: " " +[#]: publisher: " " +[#]: url: " " + +Move files in the Linux terminal +====== +Use the mv command to move a file from one location to another. +![Moving files][1] + +To move a file on a computer with a graphical interface, you open the folder where the file is currently located, and then open another window to the folder you want to move the file into. Finally, you drag and drop the file from one to the other. + +To move a file in a terminal, you use the ** **mv** command to move a file from one location to another. + + +``` +$ mv example.txt ~/Documents + +$ ls ~/Documents +example.txt +``` + +In this example, you've moved **example.txt** from its current folder into the **Documents** folder. + +As long as you know where you want to take a file _from_ and where you want to move it _to_, you can send files from any location to any location, no matter where you are. This can be a serious time saver compared to navigating through all the folders on your computer in a series of windows just to locate a file, and then opening a new window to where you want that file to go, and then dragging that file. + +The **mv** command by default does exactly as it's told: it moves a file from one location to another. Should a file with the same name already exist in the destination location, it gets overwritten. To prevent a file from being overwritten without warning, use the **\--interactive** (or **-i** for short) option: + + +``` +$ mv -i example.txt ~/Documents +mv: overwrite '/home/tux/Documents/example.txt'? +``` + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/21/8/move-files-linux + +作者:[Seth Kenlon][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/seth +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/ch01s05.svg_.png?itok=PgKQEDZ7 (Moving files)