Is is possible to display a progress bar when copying files in Terminal using cp?

  • 2
    …you could also consider using rsync instead. – Asmus Jul 28 '11 at 19:25
  • Is there a way to do this with an overall progress bar without installing any third party tools? Maybe a script or something? – rraallvv Dec 7 '17 at 16:38

You can use rsync instead.

rsync --progress /copy/from /copy/to
| improve this answer | |
  • 1
    Speedwise, which is faster, rsync or cp? – daviesgeek Jul 29 '11 at 17:08
  • If all files being copied do not exist in the destination I don't think there will be a noticeable difference. If some of the files do exist in the destination then it will vary because rsync does some checking. Rsync will usually (but not always) be faster in that case. – bahamat Jul 29 '11 at 17:11
  • 2
    Using rsync -P /copy/from /copy/to is equivalent to rsync --partial --progress /copy/from /copy/to which will display the copy progress, as well as resume the transfer if it is disconnected. – gh0st Jul 21 '17 at 16:03
  • And just like cp, it needs the -r flag to make it not skip directories – Alexander - Reinstate Monica May 22 '19 at 15:36

During cp, CtrlT displays the current percentage (on macOS at least)

| improve this answer | |
  • that's awesome! – felix021 Jun 13 '18 at 2:57
  • 2
    The reason this works is because Ctrl-t sends SIGINFO signals in the same way that Ctrl-c sends SIGINT signals. You can e.g. use a loop in another shell to repeatedly kill -INFO the process in question if you don't want to keep pressing the keys. Because it's a signal, it works with other utilities too, e.g. dd. Ctrl-t and SIGINFO are inherited from BSD. – HTNW Sep 3 '18 at 1:35

If you are copying large files or directories using cp, you can open up 'Activity Monitor', go to the 'Disk' tab and look for the process 'cp'. Here you can keep track of how many bytes have been written since the last boot, giving you a rough idea of the progress. (OS X 10.10).

Hope that helps!

| improve this answer | |
   strace -q -ewrite cp -- "${1}" "${2}" 2>&1 \
      | awk '{
        count += $NF
            if (count % 10 == 0) {
               percent = count / total_size * 100
               printf "%3d%% [", percent
               for (i=0;i<=percent;i++)
                  printf "="
               printf ">"
               for (i=percent;i<100;i++)
                  printf " "
               printf "]\r"
         END { print "" }' total_size=$(stat -c '%s' "${1}") count=0

It's not perfect, but it works... drop that in a directory path and name it something similar..

| improve this answer | |
  • Wait...how do I get that to run??? – daviesgeek Jul 29 '11 at 17:07
  • 2
    I don't recall whether OS X had an strace command at the time this answer was written (July 2011), but it definitely doesn't today. – Tim Ruddick Sep 4 '13 at 21:11
  • Any ideas how to run this on macOS? – rraallvv Dec 7 '17 at 14:52

You must log in to answer this question.

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