LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 09-10-2008, 07:19 AM   #1
ust
Senior Member
 
Registered: Mar 2003
Location: fasdf
Distribution: Debian / Suse /RHEL
Posts: 1,130

Rep: Reputation: 31
scp file


I would like to use scp to copy file to remote server , I would like to know how long it take to transfer the file , like below , it use 1 minute and 12 second to transfer the file , can advise how can I get the time ?

$scp local_file remote_file
testfile 100% 1380 17.3MB/s 01:12
 
Old 09-10-2008, 07:21 AM   #2
david1941
Member
 
Registered: May 2005
Location: St. Louis, MO
Distribution: CentOS7
Posts: 267

Rep: Reputation: 58
$time scp local_file remote_file

Dave
 
Old 09-10-2008, 07:48 AM   #3
ust
Senior Member
 
Registered: Mar 2003
Location: fasdf
Distribution: Debian / Suse /RHEL
Posts: 1,130

Original Poster
Rep: Reputation: 31
Quote:
Originally Posted by david1941 View Post
$time scp local_file remote_file

Dave
thx ,

I tried it , but it only output to screen , how can I output the time used to a file ? thx
 
Old 09-10-2008, 08:01 AM   #4
CRC123
Member
 
Registered: Aug 2008
Distribution: opensuse, RHEL
Posts: 374
Blog Entries: 1

Rep: Reputation: 32
Quote:
Originally Posted by ust View Post
I tried it , but it only output to screen , how can I output the time used to a file ? thx
Add a > <filename> at the end:

Quote:
$time scp local_file remote_file > filename.txt
 
Old 09-10-2008, 08:04 AM   #5
david1941
Member
 
Registered: May 2005
Location: St. Louis, MO
Distribution: CentOS7
Posts: 267

Rep: Reputation: 58
$time scp local_file remote_file >filename 2>&1

This puts both stdout and stderr in the file. I use this frequently.

Dave

Opps; slow on the response and CRC123 got ahead of me. That happens frequently. Anyone have a good way to check the list before posting a reponse BEFORE making a fool out of oneself? I'll try cutting my response, reloading the thread (checking for other responses), and pasting my response back if it is still relavent. Dave

Last edited by david1941; 09-10-2008 at 08:13 AM.
 
Old 09-10-2008, 08:47 AM   #6
ust
Senior Member
 
Registered: Mar 2003
Location: fasdf
Distribution: Debian / Suse /RHEL
Posts: 1,130

Original Poster
Rep: Reputation: 31
Quote:
Originally Posted by david1941 View Post
$time scp local_file remote_file >filename 2>&1

This puts both stdout and stderr in the file. I use this frequently.

Dave

Opps; slow on the response and CRC123 got ahead of me. That happens frequently. Anyone have a good way to check the list before posting a reponse BEFORE making a fool out of oneself? I'll try cutting my response, reloading the thread (checking for other responses), and pasting my response back if it is still relavent. Dave

thx reply ,

I tried add >test_speed 2>&1 to scp command as your suggestion , but the file test_speed is empty , the file has been transferred , can advise what is wrong ? thx
 
Old 09-10-2008, 08:59 AM   #7
CRC123
Member
 
Registered: Aug 2008
Distribution: opensuse, RHEL
Posts: 374
Blog Entries: 1

Rep: Reputation: 32
Quote:
Originally Posted by david1941 View Post
Opps; slow on the response and CRC123 got ahead of me. That happens frequently. Anyone have a good way to check the list before posting a reponse BEFORE making a fool out of oneself? I'll try cutting my response, reloading the thread (checking for other responses), and pasting my response back if it is still relavent. Dave
Sorry dave. I sometimes use the "Preview Post" button and I think it shows the most recent post's up to the point when you click.
 
Old 09-10-2008, 09:25 AM   #8
ust
Senior Member
 
Registered: Mar 2003
Location: fasdf
Distribution: Debian / Suse /RHEL
Posts: 1,130

Original Poster
Rep: Reputation: 31
Quote:
Originally Posted by david1941 View Post
$time scp local_file remote_file >filename 2>&1

This puts both stdout and stderr in the file. I use this frequently.

Dave

Opps; slow on the response and CRC123 got ahead of me. That happens frequently. Anyone have a good way to check the list before posting a reponse BEFORE making a fool out of oneself? I'll try cutting my response, reloading the thread (checking for other responses), and pasting my response back if it is still relavent. Dave

thx reply ,

I tried add >test_speed 2>&1 to scp command as your suggestion , but the file test_speed is empty , the file has been transferred , can advise what is wrong ? thx
 
Old 09-10-2008, 09:33 AM   #9
david1941
Member
 
Registered: May 2005
Location: St. Louis, MO
Distribution: CentOS7
Posts: 267

Rep: Reputation: 58
Sounds like you got the output from the scp command instead of the time. Did you include time in front of the scp command?
Dave
 
Old 09-10-2008, 09:44 AM   #10
ust
Senior Member
 
Registered: Mar 2003
Location: fasdf
Distribution: Debian / Suse /RHEL
Posts: 1,130

Original Poster
Rep: Reputation: 31
Quote:
Originally Posted by david1941 View Post
Sounds like you got the output from the scp command instead of the time. Did you include time in front of the scp command?
Dave

thx

Yes , I use time scp localfile remotefile >test_speed 2>&1


but found that the file test_speed is empty .



thx
 
Old 09-10-2008, 09:48 AM   #11
CRC123
Member
 
Registered: Aug 2008
Distribution: opensuse, RHEL
Posts: 374
Blog Entries: 1

Rep: Reputation: 32
Ok, apparently bash is executing its built in time command. Try explicitly calling the gnu version:

Code:
/usr/bin/time scp localfile remotefile >test_speed 2>&1
If you want output of scp and output of time in seperate files:

Code:
/usr/bin/time scp localfile remotefile > test_speed 2> time.txt
or
/usr/bin/time -o time.txt scp localfile remotefile >test_speed
There's a way to specify output of time command too with -f option. read the man page.

EDIT: I mean 'specify format of time command' in above line

Last edited by CRC123; 09-10-2008 at 09:51 AM.
 
Old 09-10-2008, 09:53 AM   #12
david1941
Member
 
Registered: May 2005
Location: St. Louis, MO
Distribution: CentOS7
Posts: 267

Rep: Reputation: 58
Quote:
Originally Posted by ust View Post
thx

Yes , I use time scp localfile remotefile >test_speed 2>&1


but found that the file test_speed is empty .



thx
OK, try this: time (scp localfile remotefile) >test_speed 2>&1
I think that will run your command in a sub-shell and do what you want.
Dave
 
Old 09-10-2008, 11:49 AM   #13
ust
Senior Member
 
Registered: Mar 2003
Location: fasdf
Distribution: Debian / Suse /RHEL
Posts: 1,130

Original Poster
Rep: Reputation: 31
Quote:
Originally Posted by CRC123 View Post
Ok, apparently bash is executing its built in time command. Try explicitly calling the gnu version:

Code:
/usr/bin/time scp localfile remotefile >test_speed 2>&1
If you want output of scp and output of time in seperate files:

Code:
/usr/bin/time scp localfile remotefile > test_speed 2> time.txt
or
/usr/bin/time -o time.txt scp localfile remotefile >test_speed
There's a way to specify output of time command too with -f option. read the man page.

EDIT: I mean 'specify format of time command' in above line
thx reply,

the below works , it is good.

/usr/bin/time -o time.txt scp localfile remotefile >test_speed

but if I want the output only have the time elapsed ( now there are too many information ) , can advise what can i do ? thx
 
Old 09-10-2008, 12:12 PM   #14
CRC123
Member
 
Registered: Aug 2008
Distribution: opensuse, RHEL
Posts: 374
Blog Entries: 1

Rep: Reputation: 32
Code:
/usr/bin/time -f "%e" -o time.txt scp localfile remotefile >test_speed
Look in manual page of time for more formatting options. If you don't have that man page installed, "man time" in google will do
 
  


Reply



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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
SCP: No such file or directory...but its there!? Baix Linux - Newbie 20 07-28-2012 02:42 PM
[SOLVED] scp file name with colon in it tuxstar Linux - Newbie 2 09-03-2007 08:38 AM
Trying to scp a file, why do I get this? EnVoy Linux - Newbie 2 06-28-2007 06:36 PM
transfering non-regular file using 'scp' zerg4141 Linux - Networking 2 07-17-2006 01:00 PM
SCP ??? where did the file go ?????? lub0 Linux - Security 3 10-07-2003 05:19 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 02:24 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