The tag has no wiki summary.

learn more… | top users | synonyms

68
votes
9answers
40k views

SSH easily copy file to local system

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 ...
25
votes
4answers
9k views

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 ...
22
votes
10answers
9k views

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 ...
20
votes
2answers
637 views

Why use install rather 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?
20
votes
1answer
574 views

How to move a directory, file by file? (instead of “copy then remove”)

My computer has one 500GB drive. I want to move 400GB of data from /unencrypted to /encrypted. Both directories are on the same partition, but /encrypted is handled by ecryptfs, so mv /uncrypted/* ...
16
votes
7answers
1k views

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 ...
14
votes
2answers
1k views

What happens if a file is modified while you're copying it?

What is the effect of copying a file say fileA.big (900mb) from location B to locationC. If during that cp operation, say 35% through the process, fileA.big is appended with new information and grows ...
13
votes
6answers
4k views

How do I copy all files and directories except certain ones over ssh?

Using the Linux command line, I use the scp command to copy up all the files and folders from a certain directory. However, I don't like to consume wasted bandwidth for copying up things I rarely ...
13
votes
3answers
7k views

Copy and paste a file/directory from command line

Instead of using the following command: cp {source file} {dest file} I want to be able to copy a file into the clipboard, and paste it somewhere else, in another directory. something like this: ...
11
votes
5answers
1k views

How can I copy a file and create the target directories at the same time?

I want to cp aaa/deep/sea/blob.psd to bbb/deep/sea/blob.psd How do I do the copy if the deep and sea directories don't exist under bbb so that the copy both creates the directories that are needed ...
10
votes
1answer
3k views

Best way to continue stopped move (mv) by merging directories?

I have moved (mv) a pretty large directory on my NAS (Linux based), but had to interrupt the procedure. Not being a regular Linux user, I though I could just continue and merge the rest later in. mv ...
8
votes
5answers
4k views

Easiest way to duplicate directory over FTP

I want to duplicate a directory on an FTP server I'm connected to from my Mac via the command-line Let's say I have file. I want to have files2 with all of file's subdirectories and files, in the ...
8
votes
1answer
265 views

Do any archive utilities exist that can preserve the date created file attribute on NTFS-3G?

I tried the -X switch on zip, but that did not save the date created attribute. I can get it using this method. When a file is added to a zip archive using 7-Zip, it preserves the date created and ...
7
votes
3answers
11k views

How can you move (or copy) all files of a certain type to a directory in Unix?

I'm not very familiar with all the tricks of grep/find/awk/xargs quite yet. I have some files matching a particular pattern, say *.xxx. These files are in random places throughout a certain ...
7
votes
5answers
512 views

copy smallest files first?

I have a large directory containing subdirectories and files that I wish to copy recursively. Is there any way to tell cp that it should perform the copy operation in order of file size, so that the ...
7
votes
2answers
2k views

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 ...
7
votes
2answers
3k views

How can you move (or copy) all files to a directory with the same filename prefix?

Using Bash So let's say I have a bunch of files randomly placed in a parent directory ~/src, I want to grab all the files matching a certain suffix and move (or copy) them to a ~/dist directory. ...
7
votes
2answers
651 views

How can I copy a subset of files from a directory while preserving the folder structure?

I want to move some subset of files from dirA to dirB (let's say files with "blah" in the filename), but I want all the nested directories to be the same in the new location. How can I do that?
6
votes
4answers
14k views

How to copy files from one machine to another using ssh [duplicate]

I'm using Linux (centos) machine, I already connected to the other 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 ...
6
votes
2answers
7k views

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. ...
6
votes
2answers
3k views

How do I save changed files?

I have two folders: ORIGINAL/ ORIGINAL_AND_MY_CHANGES/ My friend has a copy of ORIGINAL/. I would like to generate MY_CHANGES.tgz -- it should contain only new/changed files from ...
6
votes
2answers
5k views

How to copy only matching files, preserving subdirectories

Is there a way to do this: "How can I copy a subset of files from a directory while preserving the folder structure?", but without using rsync? Is it possible to be done using only cp, find and grep? ...
6
votes
2answers
68 views

What is the best way to synchronize files to a VFAT partition?

POSIX filenames may contain all characters except /, but some filesystems reserve characters like ?<>\\:*|". Using pax, I can copy files while replacing these reserved characters: $ pax -rw -s ...
5
votes
3answers
1k views

Resume interrupted copying process

How to resume securely and reliably process of copying file $A into backup location $B done with pv "$A" > "$B" or cat "$A" > "$B" ? (let's assume file $A is very big, e.g. LVM2 snapshot file) ...
5
votes
3answers
379 views

Copying large tree from one machine to another, maintaining ownership

I am trying to copy a large folder structure between machines. I want to maintain the ownership/rights during the copy as it is not reasonable to 'fix' the privs afterwards. Therefore, I am using the ...
5
votes
2answers
3k views

GNU “install” -d flag — how's it work?

I'm trying to write a makefile rule to copy a directory, maintaining its structure, and since all the other rules in our makefiles use install, I wanted to be consistent. In the manpage, it says: ...
5
votes
3answers
2k views

How do you compare two folders and copy the difference to a third folder?

You've got three folders: folder current, which contains your current files folder old, which contains an older version of the same files folder difference, which is just an empty folder How do ...
5
votes
2answers
149 views

Modifying zsh globbing patterns to use with cp

I'm trying to write a script to copy files recursively from a particular folder except files A.extn, B/*.extn and C/* where B and C are directories and extn is just some generic extension. This is ...
5
votes
4answers
576 views

Copying specific subfolders with directory structure to a new folder

I am having a the following directory structure: Main_Dir | ----------------------------------- Subdir1 Subdir2 Subdir3 | | ...
5
votes
1answer
3k views

bash force copy over same file

Our sysadmin has created a backup system that creates snapshots of the hard drive. When I try to restore an older version from the snapshot: cp /path/to/snapshots/foo.bar /path/to/folder/foo.bar ...
4
votes
3answers
10k views

Copy files with renaming

I have a huge file tree. Some files have same name but in different case, e.g. 'some_code.c' and 'Some_Code.c'. So when I'm trying to copy it to NTFS/FAT filesystem it asks me about whether i'm ...
4
votes
3answers
333 views

mkdir based on input from other directories

I have a directory full of albums I've ripped to FLAC format. Folders are named "Artist - Album [flac]" I need to create matching directories named "Artist - Album [mp3]" but only for certain ...
4
votes
2answers
7k views

“Permission denied, try again” while transferring files with scp

I have two servers (A and B) and my local machine. I'm trying to transfer a file from server A to server B. From server A: scp ./backup.tar user@server.b:/home/public/ Permission denied, please try ...
4
votes
4answers
3k views

How to clone/copy all file/directory attributes onto different file/directory?

I want to copy the attributes (ownership, group, ACL, extended attributes, etc.) of one directory to another but not the directory contents itself. This does not work: cp -v --attributes-only A B ...
4
votes
1answer
1k views

How to quit GNOME file copy GUI after it hangs

Many times I find GNOME file copy GUI tool (Nautilus) irritating when it stops working. It happens when: I cancel the copy or move I try to copy to blue tooth exchange folder to my friends ...
3
votes
3answers
3k views

How do I only copy files to a remote folder on another server that don't already exist in the folder… from the command line in linux?

I have two folders on two different servers. I want to sync files between A and B, however, I only want to copy files that don't already exist in folder B because these files are huge. I don't care ...
3
votes
2answers
5k views

Automate file transfer from Windows to Unix

I have the following situation: users update csv/txt files on daily basis on Windows. I use those flat files as input for my Oracle scripts which is on Unix. I need help on script/method of ...
3
votes
3answers
135 views

What filesystem should be used when transfering files between Linux systems?

I often need to move files between two Linux computers via USB. I use gparted to format the USBs. When I formatted the USB to use FAT32, the USB was unable to copy symlinks, so I had to recreate the ...
3
votes
3answers
437 views

How can I automate the process of copying files from one folder to another in Centos

I have a statistical application which runs every minute and creates charts accordingly. In order to make these charts available to other users, I need to copy the whole folder containing the charts ...
3
votes
2answers
9k views

Permissions “problem” using SCP to copy to root owned folder from local

I'm taking some early forays into setting up a basic LAMP box. It's my first time setting up the software I'll use as opposed to just being handed a working environment, so go easy on me :) I have ...
3
votes
3answers
83 views

Copy a file and overwrite the existing file

I have two images (image1.png and image2.png) in the same folder on my server, I want to run a command that overwrites image2.png to image1.png. I prefer to overwrite the image instead of deleting it ...
3
votes
3answers
53 views

The most *robust* remote file copy?

How would I go about to copy files over a very unstable internet connection? Sometimes, the connection is lost, other times the IP of one machine or the other machine is changed, sometimes both, ...
3
votes
4answers
189 views

how to rename files while copying?

How would I copy (archive style where date isn't changed) all the files in a backup directory to the user's directory while renaming each file to remove the random string portion from the name (i.e., ...
3
votes
2answers
2k views

Terminal command vs. GUI drag & drop when copying large no. of files: Any tangible benefit?

I'm finding myself in a terminal more and more often these days as I learn to do certain types of things quicker or more conveniently. However, when it comes to copying a large amount of data (i.e. ...
3
votes
1answer
569 views

File inheriting permission of directory it is copied in?

I have files created into my home directory with only user read permission (r-- --- ---). I want to copy this file to another directory /etc/test/ which has the folder permission of 744 (rwx r-- r--). ...
3
votes
2answers
456 views

How to copy multiple files but keep their extensions the same?

I am looping through a number of files, and $file represents the current file. How can I make copies or renames and keep the extension the same for this current file? e.g. if $file = x.jpg How to ...
3
votes
2answers
2k views

SELinux: Can I disable copying of certain files?

Please excuse me if this is too basic and you're tempted to throw an RTFM at me. I want to prevent users from copying certain files while granting them read access to the same files. I thought this ...
3
votes
2answers
64 views

Can I safely read a file that is appended to by another process?

If process A copies files to some location loc and process B regularly copies the files from loc to some other location, can B read a file that is currently in the process of being copied to loc by A? ...
3
votes
2answers
119 views

Advanced file filtering

I have 3 distinct folders: history, inbox, backup. I need to copy all the files from 'history' to 'inbox', only if they are not present in 'backup'. How to do this?
3
votes
2answers
806 views

How to add/replace only modified/updated files recursively for some 2 folders?

So I currently do stuff like: rm -rf ../../../$CLOUD_INSTALL_SUBDIR/lib_boost mkdir ../../../$CLOUD_INSTALL_SUBDIR/lib_boost cp -r ../../../$BOOST_ROOT_DIR/$BOOST_INSTALL_SUBDIR/lib/* ...