How to display file copy progress bar
I was just curious if there is a way to display a text mode progress bar or percent counter when using cp or another file copy utility so you can see how much of the file has been copied and how much remains. I'm just copying files around the same system. Tried scp and while it copied the file, it didn't display a progress meter. Any suggestions are greatly appreciated.
Regards, Brad |
Use scp instead, it'll do what you want.
It can also be used for copying files from remote machines that you have ssh access to. And for ftp use sftp or lftp (lftp has filename completion and recursive getting as well - can't remember about sftp). |
Gah, I really should finish reading your message before I respond to it, sorry!
You could scp user@localhost:filename filename instead, that'll make it show the progress :D if you add an ssh-key with no passphrase to your .ssh/authorized_keys it won't hassle you about passwords either. Bit of a cheat though. |
Not sure why this is happening. ssh is running:
ps -ef | grep -i ssh root 1348 1 0 07:48 ? 00:00:00 /usr/sbin/sshd -o PidFile /var/run/sshd.init.pid root 3906 3868 0 08:06 pts/1 00:00:00 grep -i ssh linux:~ # exit logout bmcneely@linux:~/data/quicken> scp bmcneely@localhost:/home/bmcneely/data/quicken/quick.tar.gz bmcneely@localhost:/tmp/quick.tar.gz bmcneely@localhost's password: unable to open display 3948: Permission denied, please try again. 3948: Permission denied, please try again. 3948: Permission denied (publickey,password). lost connection Any thoughts? |
OK, I got it to work with this command
scp quick.tar.gz bmcneely@localhost:/tmp/quick.tar.gz but it still prompts for my password. Here's my ~/.ssh.authorized_keys file cat authorized_keys localhost Thanks, Brad |
Wait, I found a site that showed how to set it up:
cd ~/.ssh ssh-keygen -t dsa cat id_dsa.pub >> ~/.ssh/authorized_keys Thanks for the help. Regards, Brad |
One last piece to the puzzle, when I run this from a shell script it doesn't show the progress bar. Here's the script:
cat qback echo Removing old files rm Q* quick.tar.gz > /dev/null echo Copying original files for archiving cp ~/win/data/quicken/Q* . > /dev/null echo Creating tar file tar cvf quick.tar Q* > /dev/null echo Zipping tar file gzip -9 quick.tar > /dev/null echo Mounting floppy disk mount /media/floppy > /dev/null echo Copying tar file to floppy disk scp quick.tar.gz bmcneely@localhost:/media/floppy > /dev/null echo Unmounting floppy disk umount /media/floppy > /dev/null echo Backup complete. Remove floppy disk from drive. |
I also changed the scp line to read as follow:
scp quick.tar.gz bmcneely@localhost:/media/floppy/quick.tar.gz > /dev/null |
Good work on figuring out the ssh key stuff ;)
Remove the redirection of stdout to /dev/null (> /dev/null), this is what's hiding the progress, because you're piping it to /dev/null instead of displaying it on screen. |
Talk about not seeing the forest for the trees. I completely spaced on the output rediection. Thanks for catching that for me. I followed the steps above that I found on the website and that helped me setup the ssh key. Thanks very much.
|
np ;)
|
rsync
rsync
rsync -rv <src> <dst> --progress r = recursive v = verbose |
Quote:
http://www.youtube.com/watch?v=mTwBlPqRZO8 |
All times are GMT -5. The time now is 08:50 AM. |