LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 03-29-2004, 04:53 PM   #1
bmcneely0
Member
 
Registered: Jul 2003
Posts: 74

Rep: Reputation: 15
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
 
Old 03-29-2004, 08:25 PM   #2
liamoboyle
Member
 
Registered: Mar 2004
Location: Wellington, New Zealand
Distribution: Debian
Posts: 127

Rep: Reputation: 15
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).
 
Old 03-29-2004, 08:28 PM   #3
liamoboyle
Member
 
Registered: Mar 2004
Location: Wellington, New Zealand
Distribution: Debian
Posts: 127

Rep: Reputation: 15
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 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.
 
Old 03-30-2004, 07:23 AM   #4
bmcneely0
Member
 
Registered: Jul 2003
Posts: 74

Original Poster
Rep: Reputation: 15
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?
 
Old 03-30-2004, 07:29 AM   #5
bmcneely0
Member
 
Registered: Jul 2003
Posts: 74

Original Poster
Rep: Reputation: 15
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
 
Old 03-30-2004, 07:33 AM   #6
bmcneely0
Member
 
Registered: Jul 2003
Posts: 74

Original Poster
Rep: Reputation: 15
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
 
Old 03-30-2004, 07:38 AM   #7
bmcneely0
Member
 
Registered: Jul 2003
Posts: 74

Original Poster
Rep: Reputation: 15
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.
 
Old 03-30-2004, 07:40 AM   #8
bmcneely0
Member
 
Registered: Jul 2003
Posts: 74

Original Poster
Rep: Reputation: 15
I also changed the scp line to read as follow:
scp quick.tar.gz bmcneely@localhost:/media/floppy/quick.tar.gz > /dev/null
 
Old 03-30-2004, 03:13 PM   #9
liamoboyle
Member
 
Registered: Mar 2004
Location: Wellington, New Zealand
Distribution: Debian
Posts: 127

Rep: Reputation: 15
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.
 
Old 03-31-2004, 02:03 PM   #10
bmcneely0
Member
 
Registered: Jul 2003
Posts: 74

Original Poster
Rep: Reputation: 15
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.
 
Old 03-31-2004, 09:15 PM   #11
liamoboyle
Member
 
Registered: Mar 2004
Location: Wellington, New Zealand
Distribution: Debian
Posts: 127

Rep: Reputation: 15
np
 
Old 02-18-2012, 03:35 PM   #12
DanCard
LQ Newbie
 
Registered: Sep 2010
Posts: 3

Rep: Reputation: 0
rsync

rsync

rsync -rv <src> <dst> --progress
r = recursive
v = verbose
 
Old 02-19-2012, 03:19 PM   #13
Geek255
Member
 
Registered: Feb 2012
Posts: 41

Rep: Reputation: Disabled
Quote:
Originally Posted by bmcneely0 View Post
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
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
gui file copy progress indicator? zero79 Linux - Software 3 07-10-2005 02:00 AM
cp with progress bar? Rotwang Linux - General 5 04-27-2005 07:49 PM
How the Progress Bar of a copy file/directory process is progressed?(any logic)? kiranprashant Programming 3 03-08-2005 06:16 AM
cp: progress bar chii-chan Linux - General 2 10-30-2003 06:30 PM
Progress Bar zael Programming 3 10-01-2003 12:20 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

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

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration