Is it possible to see cp speed and percent copied?

rsync has a flag called progress2 which shows the overall percentage:

rsync --info=progress2 source dest

As @AdrianTNT points out in the comments, from at least rsync version 3.0.9 the flag is now just --progress, so the command may be simplified to:

rsync --progress source dest

If you allow other tools than cp it's surely possible. For a single file you can use pv. It's a small tool providing nice statistics.

pv inputfile > outputfile

If you have multiple files or directories you can use tar:

tar c sourceDirectory | pv | tar x -C destinationDirectory

You can wrap it in a shell function. It's less to type and you get semantics close to the ones of cp. Here's a very simple (and not error-proof!) function:

cpstat () {
  tar c "$1" | pv | tar x -C "$2"
}

Note that some versions of tar don't support the abovementioned syntax (e.g. Solaris tar) and you have to use the following variant:

cpstat () {
  tar cf - "$1" | pv | (cd "$2";tar xf -)
}

You call it like this

cpstat sourceDirectory destinationDirectory

You can enhance it further, so that pv provides an estimation of the remaining time.

Another solution (as frostschutz mentioned in a comment) is to use rsync with the --progress option:

rsync --progress -a sourceDirectory destinationDirectory

rsync works the best for showing the progress during the copying progress.

ex:

rsync -avh --progress sourceDirectory destinationDirectory

Tags:

Cp