LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 10-16-2003, 06:42 AM   #1
police8677
LQ Newbie
 
Registered: Oct 2003
Posts: 12

Rep: Reputation: 0
Question how does the cp command work?


I'm trying the cp commend but i can't make it work right.
i have red hat and i wrote this line:

cp /directury/filename.

and when this didn't work i varied it:

cp /dirsource/filename /dirdest

and so on and so forth, but nothing seems to satisfy him!!

what should i do?
 
Old 10-16-2003, 06:53 AM   #2
kasperhans
Member
 
Registered: Oct 2003
Location: right behind the moon
Distribution: gentoo
Posts: 466

Rep: Reputation: 30
man cp there is everything about this command
 
Old 10-16-2003, 06:53 AM   #3
guygriffiths
Member
 
Registered: Jun 2003
Location: Reading, UK
Distribution: Debian 3.0, LFS
Posts: 524

Rep: Reputation: 37
What errors did you get?

cp /dirsource/filename /dirdest
should work. Have you read the manual page?
 
Old 10-16-2003, 06:58 AM   #4
Skyline
Senior Member
 
Registered: Jun 2003
Distribution: Debian/other
Posts: 2,104

Rep: Reputation: 45
You might need some options: for example:

cp -Rpdf /mnt/WINDOWS/newdocs /home/paul/Desktop

Last edited by Skyline; 10-16-2003 at 06:59 AM.
 
Old 10-16-2003, 11:42 AM   #5
police8677
LQ Newbie
 
Registered: Oct 2003
Posts: 12

Original Poster
Rep: Reputation: 0
That's exactly what I did ( cp /dirsource/filename /dirdest ), but it doesn't recognize the source name:

cp: cannot stat `/dirsource/filename': No such file or directory

if it is suppose to work... it doesn't... as far as i could understand the manual says to do exactly that.

How ever adding the brackets ([ ]) did change something, but now it doesn't reconize the target:

cp: copying multiple files, but last argument `/dirdest' is not a directory

moreover i understood there was suppose to be a short commend line when you are giving it from the target directory:

cp ~/dirsource/filename.

the dot stating: target present directory.
this idea i took from a unix instructor so i'm not too surprised it didnt work.

any suggestions?
 
Old 10-16-2003, 12:03 PM   #6
synaptical
Senior Member
 
Registered: Jun 2003
Distribution: Mint 13/15, CentOS 6.4
Posts: 2,020

Rep: Reputation: 48
/dirdest is telling linux that dirdest is in your root directory (/). you need to learn about directory structure more, it seems. for now, just use the absolute pathnames, for example, if your home directory is police (/home/police), and the two directories you mention are in police, then you would need something like this:

cp /home/police/dirsource/filename /home/police/dirdest/

you can replace /home/police with ~/ unless you are logged in as root, when you will have to use the complete pathname for user directories.

if you already are in /home/police, you can leave that off, and just use

cp dirsource/filename dirdest

notice no leading slashes, because again, that would say the folders are in the root directory (/).

hth
 
Old 10-16-2003, 12:05 PM   #7
Mega Man X
LQ Guru
 
Registered: Apr 2003
Location: ~
Distribution: Ubuntu, FreeBSD, Solaris, DSL
Posts: 5,339

Rep: Reputation: 65
Wild guess, are you typing the name correctly? Linux is a case sensitve OS, meaning that "Name" is different from "name" which is different from "NAME". make sure you are also including the extensions, as .doc, .zip, .mov etc
 
Old 10-16-2003, 12:32 PM   #8
police8677
LQ Newbie
 
Registered: Oct 2003
Posts: 12

Original Poster
Rep: Reputation: 0
synaptical, ty!
it was the unnecessary slash at the begining of the path names!

is there a short line commend for the case that you are giving it from the target directory? (like the thing with the dot)
 
Old 10-16-2003, 12:42 PM   #9
kasperhans
Member
 
Registered: Oct 2003
Location: right behind the moon
Distribution: gentoo
Posts: 466

Rep: Reputation: 30
dont think so, but you can tab it its much more easy e.g. your directory is /home/blubb/muh/ the simply type /h ,press tab,b,press tab,m,press tab
 
Old 10-16-2003, 01:05 PM   #10
police8677
LQ Newbie
 
Registered: Oct 2003
Posts: 12

Original Poster
Rep: Reputation: 0
Excellent!!
 
  


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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
make command don't work ! No2002 Linux - General 3 06-25-2005 10:26 PM
rename command won't work Red Squirrel Linux - Newbie 4 03-03-2004 08:53 PM
screen command doesn't work (??) planetkaos Linux - Software 3 09-29-2003 02:07 AM
A command that does not work hhegab Linux - Software 4 02-07-2003 11:24 AM
rpm command won't work Travis86 Linux - Newbie 11 01-02-2003 05:22 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 06:48 AM.

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