LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This 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


Reply
  Search this Thread
Old 06-02-2010, 11:47 AM   #1
jone kim
Member
 
Registered: Apr 2010
Posts: 185

Rep: Reputation: 16
Exclamation playing with cp command


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.
 
Old 06-02-2010, 11:54 AM   #2
EricTRA
LQ Guru
 
Registered: May 2009
Location: Gibraltar, Gibraltar
Distribution: Fedora 20 with Awesome WM
Posts: 6,805
Blog Entries: 1

Rep: Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297
Hi,

1)
Code:
man cp
and/or how to use Right Click Mouse Button in a GUI.
2) see 1)
3) see 1) and 2)

Kind regards,

Eric
 
Old 06-02-2010, 12:29 PM   #3
jone kim
Member
 
Registered: Apr 2010
Posts: 185

Original Poster
Rep: Reputation: 16
re::cp command

If I have got help from man page, I should have not posted it here. I need the full commands for my questions.
 
Old 06-02-2010, 12:44 PM   #4
Nylex
LQ Addict
 
Registered: Jul 2003
Location: London, UK
Distribution: Slackware
Posts: 7,464

Rep: Reputation: Disabled
You need to read the man page and try and work out a solution for yourself first. If you're having trouble with that, tell us what you've tried..
 
Old 06-02-2010, 12:44 PM   #5
EricTRA
LQ Guru
 
Registered: May 2009
Location: Gibraltar, Gibraltar
Distribution: Fedora 20 with Awesome WM
Posts: 6,805
Blog Entries: 1

Rep: Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297
Hi,

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.

Kind regards,

Eric
 
Old 06-02-2010, 08:33 PM   #6
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Mint
Posts: 17,809

Rep: Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743
Quote:
Originally Posted by jone kim View Post
If I have got help from man page, I should have not posted it here. I need the full commands for my questions.
The man page WILL answer your questions---as others have already stated, you need to tell us what you do not understand.

If you make posts here demanding a certain kind of answer, you are certain to get a negative reaction.

There are 2 magic words here---"please" and "patience"
 
Old 06-03-2010, 08:02 AM   #7
MTK358
LQ 5k Club
 
Registered: Sep 2009
Posts: 6,443
Blog Entries: 3

Rep: Reputation: 723Reputation: 723Reputation: 723Reputation: 723Reputation: 723Reputation: 723Reputation: 723
Quote:
Originally Posted by jone kim View Post
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.
 
Old 06-03-2010, 09:38 AM   #8
jone kim
Member
 
Registered: Apr 2010
Posts: 185

Original Poster
Rep: Reputation: 16
cp command

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
 
Old 06-03-2010, 03:47 PM   #9
goldeneye075
LQ Newbie
 
Registered: Feb 2009
Posts: 18
Blog Entries: 2

Rep: Reputation: 0
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 View Post
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
 
Old 06-03-2010, 09:44 PM   #10
jone kim
Member
 
Registered: Apr 2010
Posts: 185

Original Poster
Rep: Reputation: 16
to copy xampp-linux-1.6.8a.tar.gz from Desktop to /opt/:

~$ cp /home/sarkar/Desktop/ xampp-linux-1.6.8a.tar.gz /opt/
cp: omitting directory `/home/sarkar/Desktop/'
cp: cannot create regular file `/opt/xampp-linux-1.6.8a.tar.gz': Permission denied


I've problem with copying xampp-linux-1.6.8a.tar.gz file to /opt/. I think I am with wrong commands. Can anyone tell me how to copy it at /opt/?
 
Old 06-03-2010, 11:47 PM   #11
EricTRA
LQ Guru
 
Registered: May 2009
Location: Gibraltar, Gibraltar
Distribution: Fedora 20 with Awesome WM
Posts: 6,805
Blog Entries: 1

Rep: Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297
Hello,

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:
Code:
sudo cp /home/sarkar/Desktop/xampp-linux-1.6.8a.tar.gz /opt/
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.

Kind regards,

Eric
 
Old 06-04-2010, 05:30 AM   #12
MTK358
LQ 5k Club
 
Registered: Sep 2009
Posts: 6,443
Blog Entries: 3

Rep: Reputation: 723Reputation: 723Reputation: 723Reputation: 723Reputation: 723Reputation: 723Reputation: 723
Quote:
Originally Posted by jone kim View Post
to copy xampp-linux-1.6.8a.tar.gz from Desktop to /opt/:

~$ cp /home/sarkar/Desktop/ xampp-linux-1.6.8a.tar.gz /opt/
cp: omitting directory `/home/sarkar/Desktop/'
cp: cannot create regular file `/opt/xampp-linux-1.6.8a.tar.gz': Permission denied
What is that space doing between Desktop/ and xampp-linux-*?

And remember, you can type "~" instead of "/home/<username>/".

Because you appearantly don't know anything about the Unix shell, please read the LinuxCommand tutorial in my sig.
 
1 members found this post helpful.
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
wc -l command and playing with it shoemoodoshaloo Linux - Newbie 6 06-10-2009 02:26 PM
Playing and looping audio cds from command line barker1977 Linux - Software 5 08-31-2008 06:02 PM
LXer: CLI Magic: Playing music from the command line with mp3blaster LXer Syndicated Linux News 0 03-28-2006 03:09 PM
No sound when playing audio files on Fedora using command line players k_wjss Linux - Newbie 0 10-01-2004 01:32 AM
command line way of playing .mp3? purpleburple Linux - General 4 10-14-2002 12:27 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 04:13 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration