Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I know that I can copy files from my computers with scp. Is there a way to move them at once instead of copying with ssh?

share|improve this question
up vote 7 down vote accepted

One way would be to mount the SSH using sshfs. It's fairly quick, fairly clean and doesn't need root to action. There's a little bit of setup to do (that may actually be optional these days) but you can read about that on its help page.

But here's how I just mounted my media centre's home in a subdirectory of my local home:

oli@bert:~$ mkdir tim # create a directory to mount on
oli@bert:~$ sshfs oli@tim:/home/oli tim
oli@bert:~$ ls tim  kernelbuild  key  uberboxee

Once you're at that point, the remote filesystem and local filesystem act as one. You can move things into the mounted volume as you like. When you're done, just fire off fusermount -u the_dir_you_mounted_on:

oli@bert:~$ fusermount -u tim
oli@bert:~$ ls tim
oli@bert:~$ # there's nothing there because there's nothing mounted on it
share|improve this answer
Worth mentioning that this is further made simple by using SSH key authentication instead of passwords. And I've made "tim" resolve to its local network IP by editing /etc/hosts. – Oli Apr 7 '11 at 13:16
If you need to specify a different port, use the -p [port] option as in sshfs oli@tim:/home/oli tim -p 1234. If you have multiple SSH keys, and do not want to create a ~/.ssh/config file first, you can use the -o IdentityFile=/path/to/id_rsa option. – Lekensteyn Apr 7 '11 at 13:30
I am aware of sshfs but I was more interested in one line command. Piping as it seems its a solution but for the general interest of mine it would be funny to have smv like scp. – topless Apr 7 '11 at 14:02
You could certainly write a smv alias or a bash script to scp-then-'rm' if it's really a bother. – Oli Apr 7 '11 at 14:21

Well SCP stands for Secure Copy (Not Secure Move ;). Joking) but for what i have read in the man pages, help sites and others there is no way to use scp to "move" a file. Just copy it.

You might try: scp FILE user@domain: && rm FILE

I added the && since && will only run the next command IF the first one succeeds.

Sorry could not be more helpful with the specific scp problem. I use scp a lot too.

If you want, you could use rysnc which i find it sometimes better than scp.

You could rsync --remove-source-files FILE user@domain: which i even find it better if you loose connection to the server (big files for example) since rsync can continue with even the --partial and --progress flags

share|improve this answer
+1 but I ll go with sshfs as an answer due to elegancy :) – topless Apr 7 '11 at 14:03

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.