Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [cp]

Questions relating to the Linux 'cp' command.

0
votes
1answer
24 views

Can I use a list of file names that I saved to file to have each file on the list copied/moved/deleted?

How can I use cp rm or mv commands to manipulate files saved to a list, for example one made like so: ls Downloads/ | grep example > example.tmp The point is to be able to view/edit the file list ...
0
votes
0answers
30 views

Error while copying to flash derive

I tried to copy contents to usb(host system with ubuntu 16.04), this return is no error and but no "done" dialog box appears and havn't allocate any space in USB. it seems something like infinite ...
2
votes
1answer
92 views

Can't Copy from NTFS to EXT4

Running Kubuntu 18.04.01 bionic. I've tried Dolphin and the terminal but can't copy a .MOV file from 1TB usb drive NTFS to EXT4 on an Asus laptop. The permissions of the NTFS file show world rwx and ...
0
votes
0answers
18 views

60-latin.conf not a directory error in Ubuntu 16.04

I'm not able to login to system. When I tried to reinstall Ubuntu-desktop I'm getting error like Cp: cannot stat: /etc/fonts/conf.d/60-latin.conf not a directory and Plymouth failed with return 1 ...
0
votes
1answer
47 views

Linux: copy a list of file whose name suffix is listed in a txt file from one directory to another

I want to copy all the files that contain in their name the strings that are listed in a .txt file. How can I do it?
0
votes
1answer
33 views

Does storage affect file caching in cp?

I read somewhere that cp uses file caching, but why does coping something the size of ~100MB result in a file cache of more than 100MB in ram? Does this also change if copying from HDD -> HDD,SSD -> ...
0
votes
2answers
42 views

Copy only images in a specific directory ignoring the sub-directories in it

Excuse me for my Bad english.I want to copy only images(.png) present inside a specific directory(serenity) ignoring the sub-directories(datatables, images..etc,) in that, to another directory. ...
12
votes
1answer
2k views

Overwritten /usr/share/bin. Am I doomed?

I just managed to overwrite /usr/share/bin and it doesn't seem like it's possible to undo. I did this as a root user. Am I doomed?
0
votes
0answers
29 views

Does cp --update work with a samba share?

I have the impression that files I copy to a mounted samba share with cp -u are copied also when in fact the source file is older than the destition file. Or are there other timestamps then the one I ...
0
votes
0answers
57 views

Copy bootmgfw.efi from one mount to another mount

Due to a failed Windows Update my windows boot got corrupted which forced me to follow the turorial listed here: Error: premature end of file /EFI/Microsoft/Boot/bootmgfw.efi Link for the tutorial:...
1
vote
1answer
53 views

Removed all files from Kindle device via cp command

I tried to copy a file to a Kindle device via command line in the following way: cp filename /dev/sdb5 where sdb5 is the name of that device. As result, all files from the Kindle device are removed. ...
1
vote
1answer
2k views

cp: cannot create regular file: Read-only file system

I have an bootable flash-card (with acronis (not my installation)), I may read but cannot copy file into it. When I uses windows, then I not have any problem, but I cannot use this card in ubuntu - ...
1
vote
1answer
1k views

cp: cannot stat: No such file or directory exists [duplicate]

Orienting myself with basic terminal commands (Ubuntu 16.04); I have a file listed in my Downloads folder; a Jupyter notebook file called, 'Indexing and Slicing.ipynb' and wish to copy the file to my ...
3
votes
0answers
77 views

How can I clone my installation to a btrfs partition and make it bootable?

I'm trying to copy all files, configuration, everything, to a new btrfs partition without reinstalling. So far, what I've tried is to go to a live cd session (which is actually booted from an iso ...
0
votes
0answers
30 views

Reliable safe way to copy multiple directories to backup folder? Linux Script [duplicate]

I have defined a list of folders I want my script to read from, for each folder in the list I want to copy all content to a backup folder I run cp -r /next_folder_inlist /to_backup , in a while loop ...
0
votes
1answer
25 views

Error while running Bash Script within landscape web UI

On landscape quickstart I running a simple script from the UI. My script look like that: #!/bin/bash cp $LANDSCAPE_ATTACHMENTS /home/afadmin/Downloads/ I got the following error: cp: omitting ...
1
vote
0answers
41 views

cp command removing files

I am attempting to copy a directory with many directories inside it. I am using cp -v -R source /mnt/dest. When I go back to the source all the files are missing, but the folder is there. I am ...
0
votes
1answer
69 views

Home folder synced to HD: results differ!

I'm new to Ubuntu. I would like to have an exact copy of my home folder on my Hard drive. I've tried the following (no programs running on Ubuntu): 1. Copy-paste ~/ to /dest1/ per drag and drop in ...
10
votes
2answers
519 views

Copy and paste a bunch of files with different name

I have a bunch of text files with the name foo_bar_abc_1_01_geh_original.in foo_bar_abc_1_02_geh_original.in foo_bar_abc_1_03_geh_original.in ... ... foo_bar_abc_1_1000_geh_original.in I would like ...
0
votes
0answers
36 views

Bash script : Navigate within directory and read the value from text file

I am trying to read a text file and then navigate inside the directory as per the first chars of the line i read from the file. please check the script below. #!/bin/bash filename="/...
7
votes
2answers
2k views

Copy file and keep same timestamp of original file

I need to copy file and after that I need to change timestamp attributes as original file. How to do it with terminal or any other way.
1
vote
1answer
46 views

Find, rename and copy files to a new directory

I have 3 files under a directory that represents the time which is under a directory that represents a date. Each time directory has similar files. I'm basically saving earth's magnetosphere ...
-3
votes
1answer
800 views

What is the use of cp -i command?

Everywhere I read the following description. -i, --interactive :::::::Before overwriting an existing file, prompt the user for confirmation. If this option is not specified, cp will silently ...
1
vote
1answer
34 views

Merge one folder onto another but keep diff (non-existing) files

Suppose I have the following structure: Folder-A File-1 File-2 File-4 Folder-A-1 File-5 File-6 Folder-A-2 File-7 Folder-B File-1 File-2 File-3 ...
0
votes
2answers
36 views

Copy one file to different, differently named folders

I have a need to copy one file from /a/b/ folder to /a/c/, a/d/, a/e/ Besides using cp file.name /a/c cp file.name /a/d cp file.name /a/e in the terminal, is there a way to use one line? I have ...
0
votes
1answer
267 views

Cp does not copy file

This does not copy the file. I am owner of both directories. And there are no messages? cd /home/andy/.mozilla/seamonkey/4e39n1np.default/ cp -f bookmarks.html /home/andy/.mozilla/firefox/mltw8z53....
1
vote
1answer
474 views

Copy file using sudo access

How I can copy file or folder for other user. New file or folder must have his name. I have sudo access for cp command USER1 ALL=(ALL) NOPASSWD: /bin/cp I am trying following command: USER1@...
0
votes
4answers
398 views

cp command for backup

I'm trying to copy (backup) a specific folder files (no directories and sub-directories files) to a second folder. I nested find command with backstick but it give me error for each file with ...
6
votes
1answer
343 views

High copy speed at begining of copying

When I copy file (doesn't mater which process I use - krusader, cp, dd, ...) firstly its very fast, like way too fast (around 7000 MB/s to USB 2.0 pen-drive). Then it suddenly slows down (usually at ...
1
vote
2answers
404 views

How to exit (kill) the command cp

I have this question: creating an at job that copies all files in your home directory to /var/tmp within half an hour. You may want to create a sub-directory in /var/tmp. A message will appear to ...
0
votes
1answer
227 views

How to copy files from a folder using the find command with the -exec action, or with xargs, to another folder

I'd like to use the find command with the -exec action with the plus (+) sign (for efficiency), or with xargs to copy files from one directory to another. The following answer did not work for me. I'm ...
0
votes
0answers
20 views

Force cp to create subdirectories [duplicate]

How do I force the cp command to create subdirectories? For example, if have this file: /home/test1/x/y/z.jpg and this folder /home/test2/temp/. cd /home/test1 cp -r ./x/y/z.jpg /home/test2/temp ...
3
votes
2answers
6k views

Is there a way to create backup copy of a file, without type its name twice? [duplicate]

Often when I'm editing some system file first I create a backup copy. For example: sudo cp /etc/ssh/sshd_config /etc/ssh/sshd_config.bak Is there any simple 'shortcut' like as: sudo cp /etc/ssh/...
0
votes
3answers
2k views

Recursively copy the contents of subfolders [closed]

I want to copy the contents of src folders to new directories at a different location that have the names of the original src directories' parent directories. Here is an illustration of what I am ...
0
votes
1answer
787 views

Copy and Rename at the same time - No such file or directory

shuf -zn1 -e *.jpg | xargs -0 cp -vt /home/myspace/ result i.e. Image00005.jpg BUT, I want to rename the file at the same time i.e. Image00005.jpg to Image.jpg Tried: shuf -zn1 -e *.jpg | xargs -...
3
votes
2answers
3k views

How do I copy a directory into itself?

I can copy a directory like so: ~$ cp -r ./Desktop/ /tmp/ Similarly, if I just wanted to copy the files from within a directory, I could do so: ~$ cp -r ./Desktop/. /tmp/ Things become a little ...
2
votes
2answers
65 views

Copy files that ends in a number from a directory

How could I copy every regular files (not directories or any other type) from ~/foo that ends in a digit greater or equal than 3 to ~/bar? I tried with the find and cp commands, but I couldn't get it ...
0
votes
2answers
223 views

Move images from computer to usb thumb drive from terminal window ubuntu

New to Ubuntu and would like clear instructions on how to copy files (images) from my ubuntu machine to a usb drive. I can see the drive using lsblk as sdb1. Do i need to mount and why do i need to do ...
0
votes
1answer
101 views

How to watch a directory and `cp` file on change?

I'm building a little website generator, and I want to be able to watch some files. For example images, or js files. And then, when those files change, I'd like to copy them over to the site directory....
0
votes
1answer
2k views

What does the output of file “/bin/cp” mean

The output of file /bin/cp is : /bin/cp: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 2.6.32, BuildID[sha1]=...
1
vote
1answer
623 views

Copying files from home directory to computer directory

I am trying to copy a .php file from my Documents directory to /var/www/html. I would do this in the GUI, but I don't have root access, only in the terminal. How would I go about doing this?
6
votes
2answers
745 views

How can I duplicate a file x times in a different directory with terminal?

I am trying to duplicate an image file to a different folder x times (100 times). How can I do this in the terminal? I succeeded in duplicating in same folder, but I need to duplicate in another ...
4
votes
1answer
2k views

BASH copy to another directory not working

Firstly, I'll admit that I am new to UNIX based systems, I am currently learning at college. I'm trying to create a function that automates a backup of an existing file to an existing directory. ...
-1
votes
1answer
172 views

How to quickly copy 750Gb of data from 1Tb Elements external hard drive to 2Tb external hard drive

Please to explain me step-by-step with an example or screenshots. I tried copying the data using rsync and cp but I failed and the data was copied too slowly.
0
votes
1answer
203 views

Virtual host error duplicate

I'm running the following command: sudo cp /etc/apache2/sites-available/default /etc/apache2/sites-available/projecttest.com and I am getting the following error: cp: cannot stat ‘/etc/apache2/...
34
votes
7answers
141k views

how do you copy a directory and its contents to a new location under a new directory name?

I'm new to the Linux command line and am trying to get to grips with the copy command at the moment. Can anyone please tell me if it's possible to copy a directory with its subdirectories and ...
-1
votes
1answer
81 views

Ubuntu problem when trying to copy ISO

I have dowloaded an ISO image and I am trying to follow the installation instructions. I have mounted the ISO using the following command: sudo mount -o loop /home/pinkd/Desktop/isofile.iso /media/...
6
votes
3answers
14k views

copy two files at a time

What to do if I want to copy two file at a time using command ? let's say I have one folder named ABC and files are mno.txt xyz.txt abcd.txt qwe.txt and so on (100 no. of files) Now I want to cp ...
4
votes
1answer
1k views

Trying to copy a directory with cp and it is taking forever (I think)

I connected an external hardrive in my pc. I switch to root. I have mounted the disk successfully! (Yay me!!) Now I want to copy an entire directory from the external hard drive to my local folder. ...
2
votes
1answer
176 views

How to find files and copy to not existing folder in one command?

For example: find /usr -type f -name "*.txt" -exec cp -r {} ~/txts/ \; Works fine in case when we have existing directory txts. As far as I can understand - cp have no flags to resolve this case. ...