Server Fault is a question and answer site for system and network administrators. 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

If someone (i.e. my VPS provider), does the following command, how can I from my ssh know if the copy is complete? Thanks

cp /home/abc/hugeDir /home/cba
share|improve this question
In Linux/Unix commands are synchronous unless you send them to background (e.g. by a ` &` appended). The cp command is visible to all users, unless the admin has enabled obfuscations. – ott-- Jun 21 '13 at 21:04
Your question is ambiguous. Some answerers, including the one you accepted, assume you mean "has completed" while others assume you mean that whether anything was missed. – Dennis Williamson Jun 22 '13 at 2:03
up vote 6 down vote accepted

You can just check the process list:

ps aux | grep cp

If the prcoess is finished, it will vanish from the list.

share|improve this answer

Use md5deep on the source directory and when they tell you the copy is complete use it on the destination directory, the output hash should be the same.

share|improve this answer

There are many approaches; however, I find one to be very easy and simple to apply.

I recommend to use rsync and start a data transfer; if no files are copied, the initial copy must have been complete.

Example command:

rsync -Hav --progress /home/abc/hugeDir /home/cba

If you want to know what the options mean simply type in "man rsync".

share|improve this answer
I don't think that's what the OP means. – Sven Jun 21 '13 at 20:57

If you know how much they are supposed to transfer you can watch du -hs /path/to/target/dir to see when it reaches the right size.

share|improve this answer
You can edit answers, no need to delete and repost. – Sven Jun 21 '13 at 21:44
Yeah, but since the answer contained two solutions it was better to split it. Also, the other solution was, as you said, infeasible. – l0b0 Jun 21 '13 at 21:45
Running du in watch could be very expensive. – Dennis Williamson Jun 22 '13 at 2:00

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.