![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| UNIX for Advanced & Expert Users Expert-to-Expert. Learn advanced UNIX, UNIX commands, Linux, Operating Systems, System Administration, Programming, Shell, Shell Scripts, Solaris, Linux, HP-UX, AIX, OS X, BSD. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| How can I get a processor's CPU Percentage? | sangjinn | High Level Programming | 3 | 10-09-2008 08:28 AM |
| how do I calculate percentage ? | the_learner | High Level Programming | 6 | 04-18-2007 04:40 PM |
| how to make percentage of a running script? | jimmbp | Shell Programming and Scripting | 1 | 01-31-2006 02:41 PM |
| Computung Percentage | preetikate | UNIX for Dummies Questions & Answers | 2 | 02-09-2004 10:13 AM |
| percentage sign in a drive mapping ? | simon2000 | UNIX for Advanced & Expert Users | 2 | 09-17-2002 12:30 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
how to get the percentage of completion? during a copy!
Hi all,
I would like to know how to introduce that progress bar or the %of completion during copy of files... In the sense,I am copying a few files onto RAM at the boot time.... These 2 files combined take about 550mb of ram,so instead of just having a blinking cursor till the copy is over,i thought of giving a percentage of completion value... But how do i do that? How to get that ,1%......10%......100%.. Something like this!! Pls advice! |
|
||||
|
Some slow commands offer a hook to let you know how far they are getting. What are you using to copy the file?
Some versions of dd will report the transfer rate (the same report you get at the end) when you send them a SIGUSR1. So you could use dd to copy and signal it, say, once per second to get a progress report. Post-process it in your script to turn it into something user friendly. |
|
||||
|
i am using cp to copy the files!!!!
Can you specify accordingly... the reason is at the point in time when this copy is being made, the dd binaries are not loaded so i will have to do some extra work to get these as well.. So i would appreciate if we can keep the cp and yet provide some sort of user readability!!! thanks |
|
||||
|
Welp, unless your version of cp has hooks for this, the best you can do is guess. It's probably more aggravating than helpful if the guesstimated remaining time is completely off base, so perhaps it's just better to display a spinning cursor.
You could copy a smaller file first to calibrate, and then extrapolate a time estimation from that, but what if the disk gets jammed or another process accesses the disk at the same time? If you don't have dd, chances are any useful tools for cobbling together some eye candy won't be available either ... (I'd be hoping that dd is available if cp is, though.) Another approach would be to run cp in the background and watch the size of the destination file, and calculate a percentage from that. I'd be nervous about putting cp in the background and lose on error checking etc just to get some pretty text on the screen, though. |
|
||||
|
Thanks for the info,...
However the cp was not there in the ramdisk either,I had to relocate the binaries of cp frm another suitable OS then i was able to use it... So i will have to do the same with dd as well... How ever i am not familiar with dd... So if you could give me the command line of dd? and also if i use dd,how may i have the privalage of getting the % Thanks! |
|
||||
|
On second thought, I'm not sure it's any better than cp and monitoring the size of the destination file.
Anyway, before you invest heavily into it, check that your version understands SIGUSR1 -- not all of them do. dd has a notoriously iffy syntax. In fact I read somewhere that it was meant as a joke on the perversity of another syntax (JCL if I recall correctly) but somehow it just stuck. Code:
dd if=/path/to/input/file of=/path/to/output/file |
|
||||
|
well, there is this:
Lamby’s Blog “Can you get cp to give a progress bar like wget?” |
| Sponsored Links | ||
|
|