LinuxQuestions.org
Visit Jeremy's Blog.
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 02-01-2004, 09:15 PM   #1
shanenin
Member
 
Registered: Aug 2003
Location: Rochester, MN, U.S.A
Distribution: Gentoo
Posts: 987

Rep: Reputation: 30
cp -a or cp -R differences


I have been reading through man cp . I was trying to sort it out.
Code:
-a, --archive
              Preserve  as much as possible of the structure and attributes of
              the original files in the copy (but do  not  preserve  directory
              structure).  Equivalent to -dpPR.
What does that mean do not preserve directory structure
Code:
 -p, --preserve
              Preserve the original  files'  owner,  group,  permissions,  and
              timestamps.
doesn't -R preserve like the -p option?
Code:
-R, --recursive
              Copy directories recursively, preserving non-directories.
 
Old 02-01-2004, 09:32 PM   #2
snacky
Member
 
Registered: Feb 2004
Distribution: Debian
Posts: 286

Rep: Reputation: 30
No. -R is just for copying whole trees intact.

-a and -p are for something more subtle: keeping timestamps, permissions and ownership the same. This is useful for archiving but not for anything else.

For regular use, I assume -R is the option you're looking for.
 
Old 02-01-2004, 09:45 PM   #3
shanenin
Member
 
Registered: Aug 2003
Location: Rochester, MN, U.S.A
Distribution: Gentoo
Posts: 987

Original Poster
Rep: Reputation: 30
does -R keep permissions the same(not ownership)?
 
Old 02-01-2004, 10:01 PM   #4
snacky
Member
 
Registered: Feb 2004
Distribution: Debian
Posts: 286

Rep: Reputation: 30
Depends on who's copying it.

Remember, cp has to write a new copy. The written files will normally be owned by the person who writes them, right? That's how it'll be with -R. So if you cp -R your friend's directory of files into your own home directory (e.g. "cp -R ~myfriend/mp3s/ ~"), the copy will be owned by YOU, not your friend.

I'm pretty sure you won't ever need -a or -p unless you're archiving stuff for backup purposes. Knowing cp -R is useful, however. It sounds like you're just reading through manpages in case you find something that happens to be worth knowing, am I right?
 
Old 02-01-2004, 10:44 PM   #5
shanenin
Member
 
Registered: Aug 2003
Location: Rochester, MN, U.S.A
Distribution: Gentoo
Posts: 987

Original Poster
Rep: Reputation: 30
I was following the LFS-5.0 book. so I was trying to read and understand what it was telling me to do. Just trying to make sence of it all

edit/added

I understand ownership would change, but was not sure about permissions.

Last edited by shanenin; 02-01-2004 at 10:45 PM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
what are the differences? LinuxPadawan Linux - General 10 07-27-2005 03:39 PM
Differences between 9.1 and 10 mikeymorgan Slackware 4 03-28-2005 04:42 AM
some differences linuxanswer Programming 1 04-09-2004 10:13 PM
R and TM differences? mikeshn General 1 09-10-2002 08:01 PM
what are some differences between C and C++? Chooco Programming 9 06-07-2002 07:14 AM


All times are GMT -5. The time now is 10:24 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration