LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel
User Name
Password
Linux - Kernel This forum is for all discussion relating to the Linux kernel.

Notices


Reply
  Search this Thread
Old 09-25-2017, 10:52 AM   #1
praveenvk
LQ Newbie
 
Registered: Feb 2010
Posts: 3

Rep: Reputation: 0
cp command file transfer time


Hi,

I am using cp command to transfer file from /home to /var directory, but what I see is even after cp command return, data is being still copied from kernel buffer to disk in the background for sometime.
Here I want to calculate the exact file transfer time taken using cp command.

How to calculate? Please help me if anyone has clear idea.
 
Old 09-25-2017, 10:58 AM   #2
Keruskerfuerst
Senior Member
 
Registered: Oct 2005
Distribution: SLES 12
Posts: 1,876

Rep: Reputation: 134Reputation: 134
You can display the copy time by using the following command: time (cp xyz).
 
Old 09-25-2017, 01:10 PM   #3
ondoho
LQ Addict
 
Registered: Dec 2013
Posts: 6,997
Blog Entries: 4

Rep: Reputation: 1682Reputation: 1682Reputation: 1682Reputation: 1682Reputation: 1682Reputation: 1682Reputation: 1682Reputation: 1682Reputation: 1682Reputation: 1682Reputation: 1682
maybe?

Code:
time ( cp this that ; sync )
 
Old 09-25-2017, 01:45 PM   #4
Keruskerfuerst
Senior Member
 
Registered: Oct 2005
Distribution: SLES 12
Posts: 1,876

Rep: Reputation: 134Reputation: 134
Ok. I have forgotten the sync command.
 
Old 09-26-2017, 02:26 AM   #5
praveenvk
LQ Newbie
 
Registered: Feb 2010
Posts: 3

Original Poster
Rep: Reputation: 0
cp command

I agree sync command ensures all the data in memory are copied to disk.

But I want to measure the file transfer time using single command Or

Is there any way to capture end to end file transfer speed in Linux?

Regards,
praveen
 
Old 09-26-2017, 03:23 AM   #6
pan64
LQ Guru
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 9,895

Rep: Reputation: 2921Reputation: 2921Reputation: 2921Reputation: 2921Reputation: 2921Reputation: 2921Reputation: 2921Reputation: 2921Reputation: 2921Reputation: 2921Reputation: 2921
I do not really understand what do you need. What is the problem with the command time?
What do you really want to measure?
What do you mean by
Quote:
end to end file transfer
 
Old 09-26-2017, 07:31 AM   #7
praveenvk
LQ Newbie
 
Registered: Feb 2010
Posts: 3

Original Poster
Rep: Reputation: 0
Actually I want to calculate file transfer time in Linux to benchmark memory driver performance. say for ex. memory to disk.
I tried following commands to measure time,
Eg.
1st command,
$time cp /var/file1 /tmp/
2nd command,
$time cp /var/file1 /tmp/;sync
In 1st command, I found cp command is not giving exact file transfer time, because I could see file is still being copied after cp returns.
Second command solves the above problem, because sync synchronize data. Here problem is cp command runs first and outputs time and calls sync, so still time gives same value.
 
Old 09-26-2017, 11:55 AM   #8
ondoho
LQ Addict
 
Registered: Dec 2013
Posts: 6,997
Blog Entries: 4

Rep: Reputation: 1682Reputation: 1682Reputation: 1682Reputation: 1682Reputation: 1682Reputation: 1682Reputation: 1682Reputation: 1682Reputation: 1682Reputation: 1682Reputation: 1682
^ erm, that's why i put the two commands in brackets.
i'm not 100% sure about the syntax, but it should have given you the general picture.
 
  


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



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] awk to parse time and file transfer size jzoudavy Linux - Newbie 36 10-14-2015 10:38 AM
Samba File Transfer Dropping in Speed Over Time devinmcelheran Linux - Server 1 10-20-2014 02:53 PM
Real time file transfer using RTP-protocol yahoosam Linux - Server 6 09-10-2012 03:25 AM
file time stamp is wrong with ssh file transfer cy163 Linux - Newbie 8 05-18-2008 02:40 AM
script to find out time taken to transfer a file aeby Linux - Networking 1 05-09-2007 06:29 AM

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

All times are GMT -5. The time now is 11:09 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration