LinuxQuestions.org
Help answer threads with 0 replies.
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, 09: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, 09:58 AM   #2
Keruskerfuerst
Senior Member
 
Registered: Oct 2005
Location: Horgau, Germany
Distribution: Manjaro KDE, Win 10
Posts: 2,199

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

Rep: Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053
maybe?

Code:
time ( cp this that ; sync )
 
Old 09-25-2017, 12:45 PM   #4
Keruskerfuerst
Senior Member
 
Registered: Oct 2005
Location: Horgau, Germany
Distribution: Manjaro KDE, Win 10
Posts: 2,199

Rep: Reputation: 164Reputation: 164
Ok. I have forgotten the sync command.
 
Old 09-26-2017, 01: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, 02:23 AM   #6
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,791

Rep: Reputation: 7304Reputation: 7304Reputation: 7304Reputation: 7304Reputation: 7304Reputation: 7304Reputation: 7304Reputation: 7304Reputation: 7304Reputation: 7304Reputation: 7304
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, 06: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, 10:55 AM   #8
ondoho
LQ Addict
 
Registered: Dec 2013
Posts: 19,872
Blog Entries: 12

Rep: Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053
^ 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 09:38 AM
Samba File Transfer Dropping in Speed Over Time devinmcelheran Linux - Server 1 10-20-2014 01:53 PM
Real time file transfer using RTP-protocol yahoosam Linux - Server 6 09-10-2012 02:25 AM
file time stamp is wrong with ssh file transfer cy163 Linux - Newbie 8 05-18-2008 01:40 AM
script to find out time taken to transfer a file aeby Linux - Networking 1 05-09-2007 05:29 AM

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

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