Copy one file to multiple files

tee < file.org file.copy1 file.copy2 [file.copyn] > /dev/null
Copies file.org to file.copy1 ... file.copyn

1
By: dacoman
2014-10-02 16:41:36
tee

These Might Interest You

  • Useful when you have multiple files or binary files that you need to transfer to a different host and scp or the like is unavailable. To unpack on the destination host copy paste output using the opposite order: openssl enc -d -base64 | gunzip | tar -x Terminate openssl input using ^d Note: gzip is outside of tar because using -z in tar produces lots of extra padding. Show Sample Output


    1
    tar -c bins/ | gzip -9 | openssl enc -base64
    mweed · 2011-02-24 22:15:23 2
  • I have come across multiple situations where I could only get to a server from a very restrictive bounce point which would not allow file transfers. I was able to uuencode a file, copy the output to a text file over putty, and then uudecode the file to transfer it. This works with any kind of file. Show Sample Output


    -4
    uuencode -m <filename> <filename>
    leprasmurf · 2009-12-22 15:28:59 0
  • In a directory hierarchy that contains multiple file types, copy only the .pdf files (in this case) and move them to a different directory, without the original directory hierarchy.


    0
    find <source_directory> -name *.pdf -exec mv {} <destination_dir> \;
    Gambusia · 2016-08-25 20:09:01 0
  • Just a quick and simple one to demonstrate Bash For loop. Copies 'file' to multiple ssh hosts.


    7
    for h in host1 host2 host3 host4 ; { scp file user@$h:/destination_path/ ; }
    andrewtayloruk · 2009-02-16 01:02:35 1

What do you think?

Any thoughts on this command? Does it work on your machine? Can you do the same thing with only 14 characters?

You must be signed in to comment.

What's this?

commandlinefu.com is the place to record those command-line gems that you return to again and again. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.

Share Your Commands



Stay in the loop…

Follow the Tweets.

Every new command is wrapped in a tweet and posted to Twitter. Following the stream is a great way of staying abreast of the latest commands. For the more discerning, there are Twitter accounts for commands that get a minimum of 3 and 10 votes - that way only the great commands get tweeted.

» http://twitter.com/commandlinefu
» http://twitter.com/commandlinefu3
» http://twitter.com/commandlinefu10

Subscribe to the feeds.

Use your favourite RSS aggregator to stay in touch with the latest commands. There are feeds mirroring the 3 Twitter streams as well as for virtually every other subset (users, tags, functions,…):

Subscribe to the feed for: