With respect to cp and mv, I've found that rsync is often a good alternative for anything more than trivial moves and copies.
rsync's ability to resume is especially handy.
Progress – A Tool to Monitor Progress for Commands in Linux (2016)
21–30 of 42 posts
Re: Progress – A Tool to Monitor Progress for Commands in Linux (2016)
#22I know what I am about to say is an absolutely ugly hack, but... If you cannot install non-standard software (example: customer owner, company operated RHEL boxes) you can get an idea of the current progress of cp/tar and similar programs by inspecting file-descriptor files in /proc. Assuming that you have a process (like cp) with pid 1234, then in /proc/1234/fd you will find files with a number (corresponding to the…
#!/bin/sh for pid in $@; do cd /proc/"$pid"/fd || continue for fd in *; do file=$(readlink "$fd"); if [ ! -z "$file" ]; then size=$( (du -b "$file" 2>/dev/null || echo 0) | awk '{print $1}') if [ "$size" = "0" ]; then continue fi pos=$(
EDIT: as mentioned elsewhere in the thread, the pv program has a way to watch a PID as well that makes this program unnecessary.
Re: Progress – A Tool to Monitor Progress for Commands in Linux (2016)
#23On macOS you can monitor the progress of many commands with Ctrl-T. With cp for example: $ cp Test Test2 ^T load: 3.42 cmd: cp 86526 running 0.01u 4.36s Test -> Test2 6%
Re: Progress – A Tool to Monitor Progress for Commands in Linux (2016)
#24It prints one period (.) for every 1000 lines of text piped into it. It just shows that there is still activity, not progress, but often this is enough.
A typical usage is:
tar xvfz some_huge_tarball.tar.gz | dots
It defaults to one dot per 1000 lines, but the first argument can be a number to specify another interval. #!/usr/bin/perl
$| = 1;
$i = 0;
if ($#ARGV ) {
print '.' unless ($i % $number);
$i++;
}
print "\n";Re: Progress – A Tool to Monitor Progress for Commands in Linux (2016)
#25Re: Progress – A Tool to Monitor Progress for Commands in Linux (2016)
#26Usually I have used pv. https://linux.die.net/man/1/pv cp pv source > target tar tar czf images.tar.gz image1 image2 image3 | pv > target gzip pv source | gzip > target.gz # or gzip
Re: Progress – A Tool to Monitor Progress for Commands in Linux (2016)
#27On macOS you can monitor the progress of many commands with Ctrl-T. With cp for example: $ cp Test Test2 ^T load: 3.42 cmd: cp 86526 running 0.01u 4.36s Test -> Test2 6%
Re: Progress – A Tool to Monitor Progress for Commands in Linux (2016)
#28Re: Progress – A Tool to Monitor Progress for Commands in Linux (2016)
#29Needs gcc-4.9 to build, which has been deprecated in Ubuntu repositories.
Re: Progress – A Tool to Monitor Progress for Commands in Linux (2016)
#30On macOS you can monitor the progress of many commands with Ctrl-T. With cp for example: $ cp Test Test2 ^T load: 3.42 cmd: cp 86526 running 0.01u 4.36s Test -> Test2 6%