{"id":9004,"date":"2026-05-30T01:58:04","date_gmt":"2026-05-29T23:58:04","guid":{"rendered":"https:\/\/mybox.com\/help\/?post_type=manual_kb&#038;p=9004"},"modified":"2026-05-30T01:58:06","modified_gmt":"2026-05-29T23:58:06","slug":"ssh-commands-mv","status":"publish","type":"manual_kb","link":"https:\/\/mybox.com\/help\/en\/knowledgebase\/ssh-commands-mv\/","title":{"rendered":"SSH Commands &#8211; mv"},"content":{"rendered":"\n<div class=\"translation-block translation-block-merged\">\n<p class=\"wp-block-paragraph\">In server administration, backend web development, and cloud systems engineering, shifting assets between directories and updating filenames is a standard operational practice. The <strong><code>mv<\/code><\/strong> command stands for <strong>Move<\/strong>. It is a core POSIX-standard terminal utility used for two primary functions: moving files or directories to a different location in the filesystem, and renaming files or directories.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Unlike copying files, the <code>mv<\/code> command is an atomic filesystem operation when moving items within the same storage partition. This means it simply updates the file&#8217;s index pointers without rewriting the actual data blocks on the disk, making the process near-instantaneous regardless of the file size.<\/p>\n\n\n\n<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_86 ez-toc-wrap-left counter-hierarchy ez-toc-counter ez-toc-custom ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">Table of Contents<\/p>\n<span class=\"ez-toc-title-toggle\"><\/span><\/div>\n<nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/mybox.com\/help\/en\/knowledgebase\/ssh-commands-mv\/#Direct_Move_Operations_and_Primary_Command_Flags\" >Direct Move Operations and Primary Command Flags<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/mybox.com\/help\/en\/knowledgebase\/ssh-commands-mv\/#1_Preventing_Overwrites_with_Interactive_Mode_mv_-i\" >1. Preventing Overwrites with Interactive Mode (mv -i)<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/mybox.com\/help\/en\/knowledgebase\/ssh-commands-mv\/#2_Protecting_Files_with_the_No-Clobber_Flag_mv_-n\" >2. Protecting Files with the No-Clobber Flag (mv -n)<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/mybox.com\/help\/en\/knowledgebase\/ssh-commands-mv\/#3_Forcing_Overwrites_Indiscriminately_mv_-f\" >3. Forcing Overwrites Indiscriminately (mv -f)<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/mybox.com\/help\/en\/knowledgebase\/ssh-commands-mv\/#Renaming_Assets_vs_Relocating_Paths\" >Renaming Assets vs. Relocating Paths<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/mybox.com\/help\/en\/knowledgebase\/ssh-commands-mv\/#Renaming_a_File_or_Folder_In-Place\" >Renaming a File or Folder In-Place<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-7\" href=\"https:\/\/mybox.com\/help\/en\/knowledgebase\/ssh-commands-mv\/#Relocating_a_File_to_an_Absolute_Brand_Directory_Path\" >Relocating a File to an Absolute Brand Directory Path<\/a><\/li><\/ul><\/li><\/ul><\/nav><\/div>\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Direct_Move_Operations_and_Primary_Command_Flags\"><\/span>Direct Move Operations and Primary Command Flags<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<\/div>\n\n<div id=\"mybox-4231982501\" class=\"mybox-content mybox-entity-placement\"><div class=\"early-access-banner-inpost\">\r\n  <div class=\"banner-left-inpost\">\r\n    <div class=\"icon-box-inpost\">\r\n      <img decoding=\"async\" src=\"https:\/\/mybox.com\/help\/wp-content\/uploads\/2026\/02\/square-info-icon.svg\" alt=\"Info\">\r\n    <\/div>\r\n    <div class=\"text-box-inpost\">\r\n      <span class=\"label-inpost\"><span class=\"translation-block translation-block-banner-text\">Early access<\/span><\/span>\r\n      <h4><span class=\"translation-block translation-block-banner-text\">Still need help?<\/span><\/h4>\r\n      <p><span class=\"translation-block translation-block-banner-text\">Contact our customer service team.<\/span><\/p>\r\n    <\/div>\r\n  <\/div>\r\n\r\n  <div class=\"banner-right-inpost\">\r\n    <a href=\"https:\/\/panel.mybox.com\/helpdesk2\/v\/list\/\" class=\"banner-button-inpost\"><span class=\"translation-block translation-block-banner-text\">Message us<\/span><\/a>\r\n  <\/div>\r\n<\/div><\/div>\n\n<div class=\"translation-block translation-block-merged\"><p class=\"wp-block-paragraph\">The basic syntax for a move operation requires passing a source path followed by a destination path: <code>mv source_destination target_destination<\/code>. To control how the command handles target collisions or overwrites, you will regularly append these core operational flags:<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"1_Preventing_Overwrites_with_Interactive_Mode_mv_-i\"><\/span>1. Preventing Overwrites with Interactive Mode (<code>mv -i<\/code>)<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">If your target destination folder already contains a file with the exact same name as the one you are moving, the standard <code>mv<\/code> command will overwrite it silently. The <code>-i<\/code> (interactive) flag forces the server to pause and ask for confirmation before destroying any existing data.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>The Action:<\/strong> Add the interactive safety filter to your execution string:<code>mv -i schema.sql archive\/schema.sql<\/code><\/li>\n\n\n\n<li><strong>The Prompt Returned:<\/strong> The terminal will stop and display a message like <code>overwrite archive\/schema.sql? (y\/n)<\/code>. You must type <code>y<\/code> and press Enter to approve the move, or <code>n<\/code> to safely cancel it.<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"2_Protecting_Files_with_the_No-Clobber_Flag_mv_-n\"><\/span>2. Protecting Files with the No-Clobber Flag (<code>mv -n<\/code>)<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">The <code>-n<\/code> (no-clobber) flag completely prevents the command from overwriting an existing file at the destination path. If a file collision occurs, the <code>mv<\/code> command simply skips the operation entirely without prompting or throwing an error.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>The Action:<\/strong> Run the no-clobber flag to execute safe bulk transfers:Bash<code>mv -n *.jpg public_html\/images\/<\/code><\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"3_Forcing_Overwrites_Indiscriminately_mv_-f\"><\/span>3. Forcing Overwrites Indiscriminately (<code>mv -f<\/code>)<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">The <code>-f<\/code> (force) flag does the exact opposite of interactive mode. It overrides any default environment aliases or read-only file permissions, forcing the server to overwrite target files immediately without prompting the user.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>The Action:<\/strong> Execute a forced overwrite loop:<code>mv -f update-package\/index.php public_html\/index.php<\/code><\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Renaming_Assets_vs_Relocating_Paths\"><\/span>Renaming Assets vs. Relocating Paths<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Because renaming a file is technically moving its data pointer to a new name within the same directory, the <code>mv<\/code> command handles both scenarios seamlessly.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Renaming_a_File_or_Folder_In-Place\"><\/span>Renaming a File or Folder In-Place<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">To change the name of an asset while keeping it inside your current working directory, simply pass the new name as the second argument:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>mv old-banner.png new-banner.png\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><em>This same logic applies to directories; executing <code>mv staging\/ production\/<\/code> will instantly rename the folder.<\/em><\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Relocating_a_File_to_an_Absolute_Brand_Directory_Path\"><\/span>Relocating a File to an Absolute Brand Directory Path<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">To move a file out of your temporary workspace and into a specific website subdirectory within your brand environment, use explicit destination target pathing:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>mv custom-plugin.zip \/home\/mybox\/yourlogin\/yourwebsite.com\/public_html\/wp-content\/plugins\/<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n<\/div>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"template":"","format":"standard","manualknowledgebasecat":[54],"manual_kb_tag":[1527,6201,6202,6203,6204,6205,6206,6207,6208,6209],"class_list":["post-9004","manual_kb","type-manual_kb","status-publish","format-standard","hentry","manualknowledgebasecat-ssh","manual_kb_tag-move-files","manual_kb_tag-mv-command","manual_kb_tag-rename-files","manual_kb_tag-move-directories","manual_kb_tag-bash-mv","manual_kb_tag-linux-mv","manual_kb_tag-atomic-move","manual_kb_tag-filesystem-operation","manual_kb_tag-interactive-mode","manual_kb_tag-noclobber"],"_links":{"self":[{"href":"https:\/\/mybox.com\/help\/en\/wp-json\/wp\/v2\/manual_kb\/9004","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/mybox.com\/help\/en\/wp-json\/wp\/v2\/manual_kb"}],"about":[{"href":"https:\/\/mybox.com\/help\/en\/wp-json\/wp\/v2\/types\/manual_kb"}],"author":[{"embeddable":true,"href":"https:\/\/mybox.com\/help\/en\/wp-json\/wp\/v2\/users\/1"}],"version-history":[{"count":1,"href":"https:\/\/mybox.com\/help\/en\/wp-json\/wp\/v2\/manual_kb\/9004\/revisions"}],"predecessor-version":[{"id":9005,"href":"https:\/\/mybox.com\/help\/en\/wp-json\/wp\/v2\/manual_kb\/9004\/revisions\/9005"}],"wp:attachment":[{"href":"https:\/\/mybox.com\/help\/en\/wp-json\/wp\/v2\/media?parent=9004"}],"wp:term":[{"taxonomy":"manualknowledgebasecat","embeddable":true,"href":"https:\/\/mybox.com\/help\/en\/wp-json\/wp\/v2\/manualknowledgebasecat?post=9004"},{"taxonomy":"manual_kb_tag","embeddable":true,"href":"https:\/\/mybox.com\/help\/en\/wp-json\/wp\/v2\/manual_kb_tag?post=9004"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}