LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 08-16-2005, 03:18 AM   #1
ewt3y
Member
 
Registered: May 2005
Location: hanoi vietnam
Distribution: mandriva
Posts: 106

Rep: Reputation: 15
cp -r


recursive is not very clear to me ( i think cp -r will copy the data and cp =R will not but only inode.
Plz tell why must add -r or -R to cp directory ??
 
Old 08-16-2005, 04:06 AM   #2
andy753421
Member
 
Registered: Apr 2004
Distribution: Gentoo
Posts: 65

Rep: Reputation: 15
as far as I understand cp -r is the same as cp -R but not quite as good in that it does something wierd with non regular files.

I dont know the reasoning behind needing -r but it's probably just a check to keep people from acidentally copying a whole lot of stuff when they didnt want to (sortof like rm -r but in reverse). If you dont like it you can put this in ~/.bashrc (assuming you use bash)

alias cp="cp -R"
 
Old 08-16-2005, 01:42 PM   #3
XaViaR
Member
 
Registered: Dec 2004
Distribution: RHEL, CentOS, SuSE
Posts: 170

Rep: Reputation: 31
when i want to copy recursively, i use cp -a . This will preserve ownership, do a recursive, and something else....i forget. But, it should be in the man file. man cp

Last edited by XaViaR; 08-16-2005 at 01:43 PM.
 
Old 08-16-2005, 01:59 PM   #4
saman007uk
Member
 
Registered: Dec 2003
Location: ~root
Distribution: Debian
Posts: 363

Rep: Reputation: 33
Quote:
Originally posted by XaViaR
when i want to copy recursively, i use cp -a . This will preserve ownership, do a recursive, and something else....i forget. But, it should be in the man file. man cp
It also copies (but not follows) symlincs.

By lookng at the man pages, there is no difference between -R and -r, they are there just for compatibility with older/other verions of cp a and/or because of the POSIX standard.
 
  


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



LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

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