{"id":2935,"date":"2018-11-08T22:35:55","date_gmt":"2018-11-08T22:35:55","guid":{"rendered":"https:\/\/www.appservgrid.com\/paw92\/?p=2935"},"modified":"2018-11-12T00:57:49","modified_gmt":"2018-11-12T00:57:49","slug":"how-to-move-files-using-linux-commands-or-file-managers-linux-com","status":"publish","type":"post","link":"https:\/\/www.appservgrid.com\/paw92\/index.php\/2018\/11\/08\/how-to-move-files-using-linux-commands-or-file-managers-linux-com\/","title":{"rendered":"How to Move Files Using Linux Commands or File Managers | Linux.com"},"content":{"rendered":"<p>Learn how to move files with Linux commands in this tutorial from our archives.<\/p>\n<p>There are certain tasks that are done so often, users take for granted just how simple they are. But then, you migrate to a new platform and those same simple tasks begin to require a small portion of your brain&#8217;s power to complete. One such task is moving files from one location to another. Sure, it&#8217;s most often considered one of the more rudimentary actions to be done on a computer. When you move to the Linux platform, however, you may find yourself asking \u201cNow, how do I move files?\u201d<\/p>\n<p>If you&#8217;re familiar with Linux, you know there are always many routes to the same success. Moving files is no exception. You can opt for the power of the command line or the simplicity of the GUI \u2013 either way, you will get those files moved.<\/p>\n<p>Let&#8217;s examine just how you can move those files about. First we&#8217;ll examine the command line.<\/p>\n<h2><b>Command line moving<\/b><\/h2>\n<p>One of the issues so many users, new to Linux, face is the idea of having to use the command line. It <i>can <\/i>be somewhat daunting at first. Although modern Linux interfaces can help to ensure you rarely have to use this \u201cold school\u201d tool, there is a great deal of power you would be missing if you ignored it all together. The command for moving files is a perfect illustration of this.<\/p>\n<p>The command to move files is mv. It&#8217;s very simple and one of the first commands you will learn on the platform. Instead of just listing out the syntax and the usual switches for the command \u2013 and then allowing you to do the rest \u2013 let&#8217;s walk through how you can make use of this tool.<\/p>\n<p>The mv command does one thing \u2013 it moves a file from one location to another. This can be somewhat misleading, because mv is also used to rename files. How? Simple. Here&#8217;s an example. Say you have the file testfile in \/home\/jack\/ and you want to rename it to testfile2 (while keeping it in the same location). To do this, you would use the mv command like so:<\/p>\n<p>mv \/home\/jack\/testfile \/home\/jack\/testfile2<\/p>\n<p>or, if you&#8217;re already within \/home\/jack:<\/p>\n<p>mv testfile testfile2<\/p>\n<p>The above commands would move \/home\/jack\/testfile to \/home\/jack\/testfile2 \u2013 effectively renaming the file. But what if you simply wanted to move the file? Say you want to keep your home directory (in this case \/home\/jack) free from stray files. You could move that testfile into \/home\/jack\/Documents with the command:<\/p>\n<p>mv \/home\/jack\/testfile \/home\/jack\/Documents\/<\/p>\n<p>With the above command, you have relocated the file into a new location, while retaining the original file name.<\/p>\n<p>What if you have a number of files you want to move? Luckily, you don&#8217;t have to issue the mv command for every file. You can use wildcards to help you out. Here&#8217;s an example:<\/p>\n<p>You have a number of .mp3 files in your ~\/Downloads directory (~\/ \u2013 is an easy way to represent your home directory \u2013 in our earlier example, that would be \/home\/jack\/) and you want them in ~\/Music. You could quickly move them with a single command, like so:<\/p>\n<p>mv ~\/Downloads\/*.mp3 ~\/Music\/<\/p>\n<p>That command would move every file that ended in .mp3 from the Downloads directory, and move them into the Music directory.<\/p>\n<p>Should you want to move a file into the parent directory of the current working directory, there&#8217;s an easy way to do that. Say you have the file testfile located in ~\/Downloads and you want it in your home directory. If you are currently in the ~\/Downloads directory, you can move it up one folder (to ~\/) like so:<\/p>\n<p>mv testfile ..\/<\/p>\n<p>The \u201c..\/\u201d means to move the folder up one level. If you&#8217;re buried deeper, say ~\/Downloads\/today\/, you can still easily move that file with:<\/p>\n<p>mv testfile ..\/..\/<\/p>\n<p>Just remember, each \u201c..\/\u201d represents one level up.<\/p>\n<p>As you can see, moving files from the command line, isn&#8217;t difficult at all.<\/p>\n<h3><b>GUI<\/b><\/h3>\n<p>There are a lot of GUIs available for the Linux platform. On top of that, there are a lot of file managers you can use. The most popular file managers are Nautilus (GNOME) and Dolphin (KDE). Both are very powerful and flexible. I want to illustrate how files are moved using the Nautilus file manager (on the Ubuntu 13.10 distribution, with Unity as the interface).<\/p>\n<p>Nautilus has probably the most efficient means of moving files about. Here&#8217;s how it&#8217;s done:<\/p>\n<ol>\n<li>Open up the Nautilus file manager.<\/li>\n<li>Locate the file you want to move and right-click said file.<\/li>\n<li>From the pop-up menu (<b>Figure 1<\/b>) select the \u201cMove To\u201d option.<\/li>\n<li>When the Select Destination window opens, navigate to the new location for the file.<\/li>\n<li>Once you&#8217;ve located the destination folder, click Select.<\/li>\n<\/ol>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.linux.com\/images\/stories\/41373\/Nautilus-1-2.jpg\" alt=\"Nautilus screenshot\" width=\"550\" height=\"433\" \/><\/p>\n<p>This context menu also allows you to copy the file to a new location, move the file to the Trash, and more.<\/p>\n<p>If you&#8217;re more of a drag and drop kind of person, fear not \u2013 Nautilus is ready to serve. Let&#8217;s say you have a file in your home directory and you want to drag it to Documents. By default, Nautilus will have a few bookmarks in the left pane of the window. You can drag the file into the Document bookmark without having to open a second Nautilus window. Simply click, hold, and drag the file from the main viewing pane to the Documents bookmark.<\/p>\n<p>If, however, the destination for that file is not listed in your bookmarks (or doesn&#8217;t appear in the current main viewing pane), you&#8217;ll need to open up a second Nautilus window. Side by side, you can then drag the file from the source folder in the original window to the the destination folder in the second window.<\/p>\n<p>If you need to move multiple files, you&#8217;re still in luck. Similar to nearly every modern user interface, you can do multi-select of files by holding down the Ctrl button as you click each file. After you have selected each file (<b>Figure 2<\/b>), you can either right-click one of the selected files and the choose the Move To option, or just drag and drop them into a new location.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.linux.com\/images\/stories\/41373\/nautilus-file-manager-2-2.jpg\" alt=\"nautilus\" width=\"550\" height=\"308\" \/><\/p>\n<p>The selected files (in this case, folders) will each be highlighted.<\/p>\n<p>Moving files on the Linux desktop is incredibly easy. Either with the command line or your desktop of choice, you have numerous routes to success \u2013 all of which are user-friendly and quick to master.<\/p>\n<p><a href=\"https:\/\/www.linux.com\/learn\/how-move-files-using-linux-commands-or-file-managers\" target=\"_blank\" rel=\"noopener\">Source<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Learn how to move files with Linux commands in this tutorial from our archives. There are certain tasks that are done so often, users take for granted just how simple they are. But then, you migrate to a new platform and those same simple tasks begin to require a small portion of your brain&#8217;s power &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/www.appservgrid.com\/paw92\/index.php\/2018\/11\/08\/how-to-move-files-using-linux-commands-or-file-managers-linux-com\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;How to Move Files Using Linux Commands or File Managers | Linux.com&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-2935","post","type-post","status-publish","format-standard","hentry","category-linux"],"_links":{"self":[{"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/posts\/2935","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/comments?post=2935"}],"version-history":[{"count":1,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/posts\/2935\/revisions"}],"predecessor-version":[{"id":3148,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/posts\/2935\/revisions\/3148"}],"wp:attachment":[{"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/media?parent=2935"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/categories?post=2935"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/tags?post=2935"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}