Questions tagged [file-copy]

Questions regarding copying files from one place to another

Common mechanisms include:

  • cp
  • rsync
  • dd
  • rcp
  • install
  • pax
  • tar
  • cpio
663 questions
1220
votes
12 answers

How to copy files from one machine to another using ssh

I am using a Linux (CentOS) machine, and I have already connected to another system using SSH. Now, my question is: How can I copy files from one system to another system? Suppose, in my environment, I have two system like System A and System B. I'm…
user3021349
  • 15,909
  • 8
  • 19
  • 21
325
votes
10 answers

Copy a file back to local system with ssh

If I'm logged in to a system via SSH, is there a way to copy a file back to my local system without firing up another terminal or screen session and doing scp or something similar or without doing SSH from the remote system back to the local system?
Shawn J. Goff
  • 45,338
  • 25
  • 134
  • 145
218
votes
10 answers

How to copy-merge two directories?

I have two directories images and images2 with this structure in Linux: /images/ad /images/fe /images/foo ... and other 4000 folders and the other is like: /images2/ad /images2/fe /images2/foo ... and other 4000 folders Each of these…
ssierral
  • 2,283
  • 2
  • 13
  • 9
151
votes
8 answers

How to sync two folders with command line tools?

Having migrated to Linux from Windows, I would like to find an alternative software to Winmerge or rather learn command line tools to compare and sync two folders on Linux. I would be grateful if you could tell me how to do the following tasks on…
user21417
137
votes
4 answers

Copy the contents of a file into the clipboard without displaying its contents

How to copy the contents of a file in UNIX without displaying the file contents. I don't want to cat or vi to see the contents. I want to copy them to clipboard so that I can paste it back on my windows notepad. I can't copy the file from that…
Web Nash
  • 2,223
  • 4
  • 15
  • 11
92
votes
4 answers

Why use install rather than cp and mkdir?

I've seen in many places used install -d to create directories and install -c to copy a file. Why not use mkdir and cp? Is there an advantage in using install?
Neaţu Ovidiu Gabriel
  • 1,049
  • 1
  • 7
  • 7
91
votes
6 answers

Is there a way to determine the optimal value for the bs parameter to dd?

On occasion I've seen comments online along the lines of "make sure you set 'bs=' because the default value will take too long," and my own extremely-unscientific experiences of, "well that seemed to take longer than that other time last week" seem…
user4443
72
votes
3 answers

Why is my PC freezing while I'm copying a file to a pendrive?

I have a really strange situation here. My PC works fine, at least in most cases, but there's one thing that I can't deal with. When I try to copy a file from my pendrive, everything is ok -- I got 16-19M/s , it works pretty well. But when I try to…
Mikhail Morfikov
  • 10,309
  • 19
  • 69
  • 104
54
votes
12 answers

Is there a faster alternative to cp for copying large files (~20 GB)?

I am a graduate student, and the group in which I work maintains a Linux cluster. Each node of the cluster has its own local disk, but these local disks are relatively small and are not equipped with automatic backup. So the group owns a…
Andrew
  • 16,315
  • 34
  • 73
  • 77
52
votes
5 answers

Duplicate file x times in command shell

I try to duplicate a video file x times from the command line by using a for loop, I've tried it like this, but it does not work: for i in {1..100}; do cp test.ogg echo "test$1.ogg"; done
Black
  • 1,989
  • 7
  • 28
  • 58
52
votes
6 answers

How do I copy multiple files by wildcard?

I have a folder with a number of files in it ABC.* (there are roughly 100 such files). I want to duplicate them all to new files with names starting with DEF.* So, I want ABC.Page1 ABC.Page2 ABC.Topic12 ...etc copied…
Octopus
  • 2,489
  • 6
  • 21
  • 25
47
votes
1 answer

What happens when you rsync without a destination?

To make the story short, I did an rsync: rsync -avP [email protected]:/tmp/ And I forgot to put in my source directory... I really meant to run: rsync -avP /tmp/ [email protected]:/tmp/ It printed a bunch of files, but I don't know where…
Questionmark
  • 3,885
  • 8
  • 37
  • 57
42
votes
1 answer

rsync to copy files which has changed

I need to copy some files from a particular directory to a different location on a daily basis. I want to copy the changes only, so planning to use rsync. These files follows the following naming convention mysql-bin.* My command looks as follows #…
Zama Ques
  • 3,186
  • 12
  • 39
  • 54
39
votes
3 answers

Fast way to copy a large file on a LAN

I am having some trouble with NFS, and I'd like to try using just plain old TCP. I have no idea where to begin, though. Hardware-wise, I am using an ethernet crossover cable to network two netbooks. To network them, I type $ sudo ifconfig eth0…
ixtmixilix
  • 13,040
  • 27
  • 82
  • 118
38
votes
2 answers

Why is this binary file transferred over "ssh -t" being changed?

I am trying to copy files over SSH, but cannot use scp due to not knowing the exact filename that I need. Although small binary files and text files transfer fine, large binary files get altered. Here is the file on the server: remote$ ls…
dotancohen
  • 15,494
  • 26
  • 80
  • 116
1
2 3
44 45