Preserving number of links with 'cp'. ( preserve number of links )
Linux - GeneralThis 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
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Preserving number of links with 'cp'. ( preserve number of links )
How can I use 'cp' to copy a file and perserve the links # to it? Below, when the file is copied the '239' get's changed to a '1'. I want that '239' preserved on the destination file. How can I do this?
If a file is copied, it's a separate copy. The only way for it to have the 239 links would be for you to create 238 links to it. What behavior are you looking for? Links pointing to two files?
I simply want the copy to reflect all the attributes it had of the original.
For example, if I use 'mv' on the file, everything is preserved including the number of links. Not so when I use 'cp'.
So basically what I want is to have the same behavior in 'cp' as I do in 'mv'. Btw, what is the command to see all the files that are pointed to this file I want to copy?
... I'm looking ot have 'cp' or another command to shift all the links to the new copy in the process ... ( I realize that a link can't point to more then one file btw )
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.