LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
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 03-11-2017, 06:37 AM   #1
QWE123
Member
 
Registered: Nov 2014
Posts: 55

Rep: Reputation: Disabled
can cp copy all files include symlink


I have a folder , there are many files and symlink under it , I would like to use the command "cp" to backup all these files ( not only the local files , also want to backup the files of the symlink , not just the symlink itself ) , can cp do that ?

I know other command eg. tar can do that , but just want to check if "cp" can do also .

Thanks
 
Old 03-11-2017, 07:10 AM   #2
smallpond
Senior Member
 
Registered: Feb 2011
Location: Massachusetts, USA
Distribution: Fedora
Posts: 4,140

Rep: Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263
You should learn about the "man" and "info" commands.
 
1 members found this post helpful.
Old 03-11-2017, 08:20 AM   #3
QWE123
Member
 
Registered: Nov 2014
Posts: 55

Original Poster
Rep: Reputation: Disabled
just would like to confirm if I use cp -R , it just copy the symlink but not the files ?

thanks
 
Old 03-11-2017, 08:46 AM   #4
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,635

Rep: Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965
Quote:
Originally Posted by QWE123 View Post
just would like to confirm if I use cp -R , it just copy the symlink but not the files ?
You do realize you could have just tried it and found out, faster than you could have posted here, right? Very simple to test..create a symlink, and try to copy it.

And as smallpond suggested, look into the man pages.
 
Old 03-11-2017, 01:53 PM   #5
ondoho
LQ Addict
 
Registered: Dec 2013
Posts: 19,872
Blog Entries: 12

Rep: Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053
just in case this isn't understood:
open a terminal and enter
Code:
man cp
=> instant benefit!
 
  


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
Symlink two folders, one copy encrypted, the other not? Thewyzewun Linux - Security 7 11-27-2016 10:33 AM
tar copy with include eodchop Linux - General 2 08-21-2009 10:46 AM
Copy the target from a symlink? menator Linux - Newbie 1 01-25-2007 07:04 AM
Tip: How to copy a symlink and its target file in a script fotoguy Programming 4 08-05-2006 03:24 PM
symlink directory eats files silindrin Debian 3 03-13-2006 08:28 AM

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

All times are GMT -5. The time now is 09:26 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