[Nottingham] cp and a progress/working indicator
Andy Smith
andy at bitfolk.com
Fri Jun 14 21:48:23 UTC 2013
Hello,
On Fri, Jun 14, 2013 at 09:43:37AM +0100, Jason Irwin wrote:
> Does "cp" have a progress option? Like "rsync" does?
No. I'd probably just use rsync.
You may want to look into the great little "pv" util, whose raison
d'être is printing progress bars. But it isn't a catchy invocation:
$ pv /path/to/source/file > /path/to/dest/file
and due to the way the destination file is created, this isn't going
to retain permissions and ownership of the source file.
I mostly use pv when there is a stream of data to pipe in and out,
so the permissions thing isn't an issue. e.g. dd a block device
across the network directly onto another machine's block device:
# dd if=/dev/sdb | pv -s 10g | ssh root at other-place 'dd of=/dev/sdb'
> I know about "-v", which is handy but on big files I have no idea if
> it's working or hung (I am haunted by the Windows demons that tell me;
> no output = yer request is screwed, pal).
> Doesn't have to be a % indicator or anything...just some clue that
> things are indeed working.
A useful tool to know what a non-chatty command is doing is strace.
Work out the process ID of whatever it is you want to monitor and
then in another terminal:
# strace -p 12345
(or whatever the PID is)
then you'll see every system call it issues fly by. ctrl-c to get
out of it (won't kill the original process).
Usually you can strace your own user's processes but need to be
root to strace another user's, although some distributions do
further restrict this so even a user can't strace their own
processes.
Cheers,
Andy
--
http://bitfolk.com/ -- No-nonsense VPS hosting
More information about the Nottingham
mailing list