How do I measure or track the progress of a command on a GNU distro?

5,154

Solution 1

You can use pv to see the progress of any command that can transfer data through pipes.

See e.g. http://www.catonmat.net/blog/unix-utilities-pipe-viewer/ for explanations. This will not work for cp however, as it does not operate via pipes.

Beyond that, there's no general mechanism I am aware of. It would be difficult, since "progress" can mean different things to different commands.

BTW, cp has an option -v which lists files as they are copied, that can give you a rough idea of its progress.

Edit:

Though it might not directly answer your question: You can also just use a graphical file manager. Most provide a nice progress bar when copying / moving files (e.g. KDE's konqueror does).

Solution 2

try append --verbose to commmands you are interested in, this will generally produce more infomation on progress.

Share:
5,154

Related videos on Youtube

Sorceri
Author by

Sorceri

SOreadytohelp

Updated on September 17, 2022

Comments

  • Sorceri
    Sorceri over 1 year

    If I run

    cp file1 file2
    

    I'd like to be able to track it's progress. Is there a command I can use for this?

    rsync --progress
    

    has this, but is there something generic, usable for "any" command?

  • sleske
    sleske over 12 years
    While this will work, it might be less efficient because you incur additional overhead for the network-transfer (even though it only uses the localhost pseudo-network-interface). However, as long as the copy is IO-bound, this will probably not matter.
  • sleske
    sleske almost 10 years
    At any rate, OP already uses rsync --progress for seeing progress during a copy operation.