↑ ↓ select, Enter open, Esc close

Move a file to another directory

Caution: This command changes the system. Understand what it does before you run it.

Adjust the values, the command updates live
user@server
mv -i -- /var/www/vhosts/example.com/httpdocs/old.zip /var/www/vhosts/example.com/private/

Moves QUELLE into the target folder and keeps the file name. The trailing slash makes mv fail with an error if the target folder does not exist, instead of saving the file under that name. -i asks before overwriting a file with the same name in the target.

Note: Within the same file system this is instant, across partitions the data is copied and then deleted.

Also searched as

  • move a file in linux
  • move a folder
  • move a file out of the web root
  • linux mv to directory

Related one-liners

All in Filesystem

Read first, then run.

The commands on myline.de act directly on servers, files and databases. A wrong path or placeholder can delete data irreversibly or make a server unreachable.

  • All commands are provided without warranty and are not tested on every system.
  • Understand what a command does before running it, and check every placeholder.
  • Make a backup first and, if possible, try it on a test system.
  • You run commands at your own risk. Liability for damages is excluded to the extent permitted by law.