Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I've various questions related to cp command.
1. Sup. I've source.txt file at my home folder and I want to copy (&cut) it at my Desktop. How can I do that?
I want to copy it at my Desktop->Destination folder, how can I do that?
2. Sup. I've a folder Source at my Home->Documents and I want to copy it at my Desktop->Destination folder. How can I do that?
3. Sup. I've a .tar file at my home and I want to copy it at /opt/. How can I do that?
Please reply the answers with the question numbers.
Then post what you've got and where you have doubts or where it's failing. That's when you encounter LQ users at their best. If you ask for a ready made solution/answer to your question, a copy/past thing, a step by step guide, then there's only one thing to say:
You'll not find it here on LQ.
Furthermore the command you're 'investigating' is so basic knowledge that I'm suspecting that this is a type of homework assignment and I don't think you'll find users willing to do it for you.
I've various questions related to cp command.
1. Sup. I've source.txt file at my home folder and I want to copy (&cut) it at my Desktop. How can I do that?
I want to copy it at my Desktop->Destination folder, how can I do that?
2. Sup. I've a folder Source at my Home->Documents and I want to copy it at my Desktop->Destination folder. How can I do that?
3. Sup. I've a .tar file at my home and I want to copy it at /opt/. How can I do that?
Please reply the answers with the question numbers.
????????????????????????????????
Isn't this obvious enough (from the cp man page):
Code:
cp SOURCE DEST
Anyway, :
Make a duplicate file
Code:
cp original duplicate
Copy foo.txt to your Desktop folder:
Code:
cp foo.txt ~/Desktop
Copy MyFolder to Desktop:
Code:
cp -R MyFolder ~/Desktop
The -R option is required if you want to copy a directory. It causes cp to go into the directory and copy the files inside it.
Copy everything in current directory to /foo/bar:
Code:
cp -R * /foo/bar
Use the -R option in case there is a directory in the current directory.
hey:
first of all make sure you have the file name correctly.
Also donot keep any spaces inbetween when specifying the destination or the source;
if your copying a file from the Desktop;(and if ur at the Desktop currently)
cp file.txt ~/Documents
will do it
if your not at the Desktop , then
cp ~/Desktop/file.txt ~/Documents
hope it helps , and do the same with the opt
golden
Quote:
Originally Posted by jone kim
I used the command to copy a ".txt" file from Desktop->Destination to Home->Documents. The file get copied to Documents but the terminal shows:
cp ~/Desktop/ destin source.txt ~/home/ Documents
cp: omitting directory `/home/sarkar/Desktop/'
cp: cannot stat `destin': No such file or directory
How to copy the xampp-linux-1.6.8a.tar.gz from home to /opt/.
I tried the command, but it was useless.
cp ~/home/ xampp-linux-1.6.8a.tar.gz /opt/
cp: cannot stat `/home/sarkar/home/': No such file or directory
cp: cannot create regular file `/opt/xampp-linux-1.6.8a.tar.gz': Permission denied
Are you logged in as root or as regular user? If logged in as a normal user (judging by the console you are) try with putting sudo in front of the command like this:
Also, as stated by other users, don't put spaces in your command line between the path and the filename (there was one, I deleted at in the command above).
If you use sudo like in the example above, the system will ask you for your password which will not be echoed, so you'll be typing blind.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.