{"id":753,"date":"2023-08-24T19:38:10","date_gmt":"2023-08-24T19:38:10","guid":{"rendered":"https:\/\/www.devopsconsulting.in\/blog\/?p=753"},"modified":"2023-10-08T05:53:08","modified_gmt":"2023-10-08T05:53:08","slug":"linux-unixs-mv-command-with-examples","status":"publish","type":"post","link":"https:\/\/www.devopsconsulting.in\/blog\/linux-unixs-mv-command-with-examples\/","title":{"rendered":"Linux\/Unix&#8217;s mv Command with Examples"},"content":{"rendered":"\n<p>Have there ever been times when you needed to transfer files or folders on your Linux\/Unix system? Fear not, though! To save the day, use the mv command. We shall study the mv command&#8217;s many features and capabilities in this post by plunging into its deep waters.<\/p>\n\n\n\n<p><strong>Simple Use<\/strong><br>Let&#8217;s begin with the fundamentals. The mv command has the following syntax:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>mv &#91;options] source destination<\/code><\/pre>\n\n\n\n<p>In this case, the source denotes the file or directory that you wish to move, and the destination designates the desired place for the file or directory to be moved.<\/p>\n\n\n\n<p>As an illustration, suppose you want to move a file called file.txt from your current directory to a new directory called new_directory. The following command can be used:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>mv file.txt new_directory\/<\/code><\/pre>\n\n\n\n<p>Simply change file.txt with the name of the directory you wish to relocate in lieu of the file.<\/p>\n\n\n\n<p><strong>Renaming Directories and Files<\/strong><\/p>\n\n\n\n<p>You may also rename files and directories with the mv command. You can choose the new name as the destination to rename a file or directory.<\/p>\n\n\n\n<p>For illustration, suppose you want to change a file called old_name.txt to new_name.txt. The following command can be used:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>mv old_name.txt new_name.txt<\/code><\/pre>\n\n\n\n<p>Similar to this, you can specify the new name of a directory as the destination if you want to rename it.<\/p>\n\n\n\n<p><strong>File Overwriting<\/strong><\/p>\n\n\n\n<p>The mv command does not, by default, overwrite already-existing files or directories. The -f option can be used, nevertheless, to replace a file that already exists and has the same name.<\/p>\n\n\n\n<p>Say, for instance, that you wish to replace the file in the destination directory with the file from the source directory and that you have a file named file.txt in both the source and destination directories. The following command can be used:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>mv -f source\/file.txt destination\/<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Have there ever been times when you needed to transfer files or folders on your Linux\/Unix system? Fear not, though! To save the day, use the mv&#8230; <\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[98],"tags":[150,149],"class_list":["post-753","post","type-post","status-publish","format-standard","hentry","category-linux","tag-how-to-use-mv-command-in-linux","tag-mv-command-in-linux"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Linux\/Unix&#039;s mv Command with Examples - DevOps Consulting<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.devopsconsulting.in\/blog\/linux-unixs-mv-command-with-examples\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Linux\/Unix&#039;s mv Command with Examples - DevOps Consulting\" \/>\n<meta property=\"og:description\" content=\"Have there ever been times when you needed to transfer files or folders on your Linux\/Unix system? Fear not, though! To save the day, use the mv...\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.devopsconsulting.in\/blog\/linux-unixs-mv-command-with-examples\/\" \/>\n<meta property=\"og:site_name\" content=\"DevOps Consulting\" \/>\n<meta property=\"article:published_time\" content=\"2023-08-24T19:38:10+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-10-08T05:53:08+00:00\" \/>\n<meta name=\"author\" content=\"Abhishek Singh\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Abhishek Singh\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.devopsconsulting.in\\\/blog\\\/linux-unixs-mv-command-with-examples\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.devopsconsulting.in\\\/blog\\\/linux-unixs-mv-command-with-examples\\\/\"},\"author\":{\"name\":\"Abhishek Singh\",\"@id\":\"https:\\\/\\\/www.devopsconsulting.in\\\/blog\\\/#\\\/schema\\\/person\\\/fc397ba8be42f9fdd53450edfc73006f\"},\"headline\":\"Linux\\\/Unix&#8217;s mv Command with Examples\",\"datePublished\":\"2023-08-24T19:38:10+00:00\",\"dateModified\":\"2023-10-08T05:53:08+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.devopsconsulting.in\\\/blog\\\/linux-unixs-mv-command-with-examples\\\/\"},\"wordCount\":300,\"commentCount\":2,\"keywords\":[\"how to use mv command in linux\",\"mv Command in Linux\"],\"articleSection\":[\"linux\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.devopsconsulting.in\\\/blog\\\/linux-unixs-mv-command-with-examples\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.devopsconsulting.in\\\/blog\\\/linux-unixs-mv-command-with-examples\\\/\",\"url\":\"https:\\\/\\\/www.devopsconsulting.in\\\/blog\\\/linux-unixs-mv-command-with-examples\\\/\",\"name\":\"Linux\\\/Unix's mv Command with Examples - DevOps Consulting\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.devopsconsulting.in\\\/blog\\\/#website\"},\"datePublished\":\"2023-08-24T19:38:10+00:00\",\"dateModified\":\"2023-10-08T05:53:08+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/www.devopsconsulting.in\\\/blog\\\/#\\\/schema\\\/person\\\/fc397ba8be42f9fdd53450edfc73006f\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.devopsconsulting.in\\\/blog\\\/linux-unixs-mv-command-with-examples\\\/\"]}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.devopsconsulting.in\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/www.devopsconsulting.in\\\/blog\\\/\",\"name\":\"DevOps Consulting\",\"description\":\"DevOps Consulting | SRE Consulting | DevSecOps Consulting | MLOps Consulting\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.devopsconsulting.in\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.devopsconsulting.in\\\/blog\\\/#\\\/schema\\\/person\\\/fc397ba8be42f9fdd53450edfc73006f\",\"name\":\"Abhishek Singh\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/790feefe779852cdf344ca7318bf6c13832223c9b3c6bf4d217658412041026d?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/790feefe779852cdf344ca7318bf6c13832223c9b3c6bf4d217658412041026d?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/790feefe779852cdf344ca7318bf6c13832223c9b3c6bf4d217658412041026d?s=96&d=mm&r=g\",\"caption\":\"Abhishek Singh\"},\"description\":\"I\u2019m Abhishek, a DevOps, SRE, DevSecOps, and Cloud expert with a passion for sharing knowledge and real-world experiences. I\u2019ve had the opportunity to work with Cotocus and continue to contribute to multiple platforms where I share insights across different domains: \u2022 DevOps School \u2013 Tech blogs and tutorials \u2022 Holiday Landmark \u2013 Travel stories and guides \u2022 Stocks Mantra \u2013 Stock market strategies and tips \u2022 My Medic Plus \u2013 Health and fitness guidance \u2022 TrueReviewNow \u2013 Honest product reviews \u2022 Wizbrand \u2013 SEO and digital tools for businesses I\u2019m also exploring the fascinating world of Quantum Computing.\",\"url\":\"https:\\\/\\\/www.devopsconsulting.in\\\/blog\\\/author\\\/abhishek\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Linux\/Unix's mv Command with Examples - DevOps Consulting","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.devopsconsulting.in\/blog\/linux-unixs-mv-command-with-examples\/","og_locale":"en_US","og_type":"article","og_title":"Linux\/Unix's mv Command with Examples - DevOps Consulting","og_description":"Have there ever been times when you needed to transfer files or folders on your Linux\/Unix system? Fear not, though! To save the day, use the mv...","og_url":"https:\/\/www.devopsconsulting.in\/blog\/linux-unixs-mv-command-with-examples\/","og_site_name":"DevOps Consulting","article_published_time":"2023-08-24T19:38:10+00:00","article_modified_time":"2023-10-08T05:53:08+00:00","author":"Abhishek Singh","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Abhishek Singh","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.devopsconsulting.in\/blog\/linux-unixs-mv-command-with-examples\/#article","isPartOf":{"@id":"https:\/\/www.devopsconsulting.in\/blog\/linux-unixs-mv-command-with-examples\/"},"author":{"name":"Abhishek Singh","@id":"https:\/\/www.devopsconsulting.in\/blog\/#\/schema\/person\/fc397ba8be42f9fdd53450edfc73006f"},"headline":"Linux\/Unix&#8217;s mv Command with Examples","datePublished":"2023-08-24T19:38:10+00:00","dateModified":"2023-10-08T05:53:08+00:00","mainEntityOfPage":{"@id":"https:\/\/www.devopsconsulting.in\/blog\/linux-unixs-mv-command-with-examples\/"},"wordCount":300,"commentCount":2,"keywords":["how to use mv command in linux","mv Command in Linux"],"articleSection":["linux"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.devopsconsulting.in\/blog\/linux-unixs-mv-command-with-examples\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.devopsconsulting.in\/blog\/linux-unixs-mv-command-with-examples\/","url":"https:\/\/www.devopsconsulting.in\/blog\/linux-unixs-mv-command-with-examples\/","name":"Linux\/Unix's mv Command with Examples - DevOps Consulting","isPartOf":{"@id":"https:\/\/www.devopsconsulting.in\/blog\/#website"},"datePublished":"2023-08-24T19:38:10+00:00","dateModified":"2023-10-08T05:53:08+00:00","author":{"@id":"https:\/\/www.devopsconsulting.in\/blog\/#\/schema\/person\/fc397ba8be42f9fdd53450edfc73006f"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.devopsconsulting.in\/blog\/linux-unixs-mv-command-with-examples\/"]}]},{"@type":"WebSite","@id":"https:\/\/www.devopsconsulting.in\/blog\/#website","url":"https:\/\/www.devopsconsulting.in\/blog\/","name":"DevOps Consulting","description":"DevOps Consulting | SRE Consulting | DevSecOps Consulting | MLOps Consulting","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.devopsconsulting.in\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.devopsconsulting.in\/blog\/#\/schema\/person\/fc397ba8be42f9fdd53450edfc73006f","name":"Abhishek Singh","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/790feefe779852cdf344ca7318bf6c13832223c9b3c6bf4d217658412041026d?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/790feefe779852cdf344ca7318bf6c13832223c9b3c6bf4d217658412041026d?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/790feefe779852cdf344ca7318bf6c13832223c9b3c6bf4d217658412041026d?s=96&d=mm&r=g","caption":"Abhishek Singh"},"description":"I\u2019m Abhishek, a DevOps, SRE, DevSecOps, and Cloud expert with a passion for sharing knowledge and real-world experiences. I\u2019ve had the opportunity to work with Cotocus and continue to contribute to multiple platforms where I share insights across different domains: \u2022 DevOps School \u2013 Tech blogs and tutorials \u2022 Holiday Landmark \u2013 Travel stories and guides \u2022 Stocks Mantra \u2013 Stock market strategies and tips \u2022 My Medic Plus \u2013 Health and fitness guidance \u2022 TrueReviewNow \u2013 Honest product reviews \u2022 Wizbrand \u2013 SEO and digital tools for businesses I\u2019m also exploring the fascinating world of Quantum Computing.","url":"https:\/\/www.devopsconsulting.in\/blog\/author\/abhishek\/"}]}},"_links":{"self":[{"href":"https:\/\/www.devopsconsulting.in\/blog\/wp-json\/wp\/v2\/posts\/753","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.devopsconsulting.in\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.devopsconsulting.in\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.devopsconsulting.in\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.devopsconsulting.in\/blog\/wp-json\/wp\/v2\/comments?post=753"}],"version-history":[{"count":1,"href":"https:\/\/www.devopsconsulting.in\/blog\/wp-json\/wp\/v2\/posts\/753\/revisions"}],"predecessor-version":[{"id":754,"href":"https:\/\/www.devopsconsulting.in\/blog\/wp-json\/wp\/v2\/posts\/753\/revisions\/754"}],"wp:attachment":[{"href":"https:\/\/www.devopsconsulting.in\/blog\/wp-json\/wp\/v2\/media?parent=753"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.devopsconsulting.in\/blog\/wp-json\/wp\/v2\/categories?post=753"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.devopsconsulting.in\/blog\/wp-json\/wp\/v2\/tags?post=753"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}