LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   How to display file copy progress bar (https://www.linuxquestions.org/questions/linux-general-1/how-to-display-file-copy-progress-bar-163915/)

bmcneely0 03-29-2004 04:53 PM

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

liamoboyle 03-29-2004 08:25 PM

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).

liamoboyle 03-29-2004 08:28 PM

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.

bmcneely0 03-30-2004 07:23 AM

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?

bmcneely0 03-30-2004 07:29 AM

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

bmcneely0 03-30-2004 07:33 AM

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

bmcneely0 03-30-2004 07:38 AM

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.

bmcneely0 03-30-2004 07:40 AM

I also changed the scp line to read as follow:
scp quick.tar.gz bmcneely@localhost:/media/floppy/quick.tar.gz > /dev/null

liamoboyle 03-30-2004 03:13 PM

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.

bmcneely0 03-31-2004 02:03 PM

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.

liamoboyle 03-31-2004 09:15 PM

np ;)

DanCard 02-18-2012 03:35 PM

rsync
 
rsync

rsync -rv <src> <dst> --progress
r = recursive
v = verbose

Geek255 02-19-2012 03:19 PM

Quote:

Originally Posted by bmcneely0 (Post 846550)
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

You can try pv. A tutorial on its usage.
http://www.youtube.com/watch?v=mTwBlPqRZO8


All times are GMT -5. The time now is 08:50 AM.