I have a remote Debian test server to which I connect via SSH (Putty client). I wanted to move a lot of files on a remote machine to another folder:

remote: /mnt/a/ -> remote: /mnt/b/c/
RESULT@remote: /mnt/b/c/a/

I've used a move (mv) command connecting to a remote computer with SSH from my local computer:

mv /mnt/a/ /mnt/b/c/

I did that with about 700 MB of data (about 5 files) and it took forever to copy those files.

Does the mv command transfer the files to the local computer through SSH and then sends it back to another folder on the server? If so, is there any other command I can use to move the files only locally on the remote server?

  • 1
    Your question is not correct : in your situation, you do not download any file to your local computer. Your issue is not related to ssh but to your Debian server (moving a file to another partition require a copy that can take time, for example).
    – Uriel
    Commented Jan 4, 2015 at 14:03
  • The mv command you show is not "connecting to a remote computer with SSH from my local computer". It should be a fairly quick operation, unless it's between filesystems in which case it can take a bit of time if the disks are slow or in heavy use.
    – Kusalananda
    Commented Jun 21, 2016 at 7:59

2 Answers 2


As long as your source and destination paths are on the same filesystem, mv won't actually "move" anything. It'll just edit your directories' and files' metadata (inodes and links), but the data blocks themselves won't move. For instance, assuming that /home and /srv are on different filesystems, you'll observe the following:

$ mv /home/bigfile.txt /home/mydir/ # Instant.
$ mv /home/bigfile.txt /srv # Takes time.

If you're moving all that data from a filesystem to another, then it has to be physically copied from a disk section to another: data blocks need to be moved, and that can take time (and to be honest, you can't do much about it).

Doing it over SSH does not change a thing. SSH stands for Secure Shell, meaning you're getting an actual remote shell, not just using your machine as a relay for everything. Whatever you request from your remote machine through SSH is handled remotely.

  • Yes, it is the same drive, but a different filesystem. I didn't realize that. Thank you! Commented Jan 4, 2015 at 14:07

To make moving files via a SSH session more robust I would urge you to use screen (or tmux or something similar). Otherwise you risk your SSH session being interrupted (network glitch, power glitch on local system, accidentally close PuTTY window, Windows goes into standby/hybernate, etc). If your SSH session gets killed then your move operation will be interrupted (unfinished - best case scenario) or data being lost/corrupted (worst case scenario).

Also IMO when moving large amounts of data rsync is a better option. Firstly because you can easily set it to show progress (so you know it hasn't stalled, etc). Secondly because if it is interrupted it can be restarted without having to redo what has successfully been done already...

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .