LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 06-09-2015, 09:54 AM   #1
skarthickbabu
LQ Newbie
 
Registered: Jun 2015
Posts: 4

Rep: Reputation: Disabled
Question Is it possible to copy one file to multiple computers


Dear All,

Is it possible to copy one file to multiple computers with single line command ?

I generally use rcp command to copy from one computer to another computer.

example:

rcp localfile host1:/home/kb/

now i would ilke to copy the local file to different host's.

so i tried in the following way, but this doesnt work
rcp localfile host1:/home/kb/ host2:/home/kb

any suggestions would beuseful to me
please help me.

regards
Karthick
 
Old 06-09-2015, 10:07 AM   #2
veerain
Senior Member
 
Registered: Mar 2005
Location: Earth bound to Helios
Distribution: Custom
Posts: 2,524

Rep: Reputation: 319Reputation: 319Reputation: 319Reputation: 319
You can use a shell script loop to do copy in serial or parallel.
 
Old 06-09-2015, 10:33 AM   #3
skarthickbabu
LQ Newbie
 
Registered: Jun 2015
Posts: 4

Original Poster
Rep: Reputation: Disabled
how can i loop them

but how can i loop them, do u have any examples?
 
Old 06-09-2015, 10:37 AM   #4
schneidz
LQ Guru
 
Registered: May 2005
Location: boston, usa
Distribution: fc-15/ fc-20-live-usb/ aix
Posts: 5,051

Rep: Reputation: 852Reputation: 852Reputation: 852Reputation: 852Reputation: 852Reputation: 852Reputation: 852
normally my response would be show your work and we will help with corrections but this is simple enough it doesnt warrant the effort of my usual lecture (... too late):
Code:
scp test.lq user1@ip1:/whatever/floats/your/boat &
scp test.lq user2@ip2:/whatever/grinds/your/gears &
 
Old 06-09-2015, 10:43 AM   #5
skarthickbabu
LQ Newbie
 
Registered: Jun 2015
Posts: 4

Original Poster
Rep: Reputation: Disabled
Since the folders i copy are on the range of 1-2 GB data, so it takes time for the first one to finish and execute the second time.
I wanted to try opening two terminal and execute at the same time, i have not tried this option because i am not sure how does the data gets distributed in copying at two different locations.
if opening in two terminal works, i am also happy as long as i don't loose the data.
 
Old 06-09-2015, 10:47 AM   #6
schneidz
LQ Guru
 
Registered: May 2005
Location: boston, usa
Distribution: fc-15/ fc-20-live-usb/ aix
Posts: 5,051

Rep: Reputation: 852Reputation: 852Reputation: 852Reputation: 852Reputation: 852Reputation: 852Reputation: 852
the ampersand (&) makes it a background process so they both fly at the same time.
 
Old 06-09-2015, 10:50 AM   #7
skarthickbabu
LQ Newbie
 
Registered: Jun 2015
Posts: 4

Original Poster
Rep: Reputation: Disabled
good to know, thank you so much. Now it sounds really silly.
Thanks for all to realize this.
 
  


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
Copy 2 files to multiple computers sunriver61 Linux - Newbie 3 04-05-2015 11:31 AM
[SOLVED] How to copy file w/ same name from multiple hosts into one Tnguyen80 Linux - General 1 12-16-2012 03:36 AM
Copy one file to multiple directories cmfarley19 Linux - General 9 11-10-2004 01:57 PM
Multiple file copy james.farrow Linux - Newbie 8 08-17-2004 09:01 AM
copy multiple files into one file HelpPlease Programming 2 12-09-2003 03:36 PM


All times are GMT -5. The time now is 07:08 PM.

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