simple ln question

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I have a script that occasionally does something like this

     ln  file1 file2

that makes it so the contents of file1 are the same as of file2, and if you change the contents of 1, the other
changes accordingly.

I can slo do this

     ln -s file1 files

which is somewhat similar, but of course works over file systems and file2 is really just a symbolic link to file1.

Anyway, sometimes I want to undo what I did, but I can't say

     unlink file2

because that will remove file2.  I just want it , so that the files are still the same but if I change one, the other will
not change (i.e., inodes are different but diff shows no differences).  I can't see any flags for ln.  Anyone have
any idea?  I know it can be fudged like

     sed -i 's/ / /g' file1

but this is kind of fudging, and it may not work on binary files.

another question.  If you have a file  FILE1 can you find everything that is linked
to it?  say you have

     ln -s /this/is/filesystem/1/FILE1  /filesystem/2/FILE2

given FILE1 can you find FILE2?  It is pretty easy the other way around (readlink FILE2) but that does
not work for FILE1.  Also if "ln" instead of "ln -s" you cannot do it.

I guess you could do  ls -i /this/is/filesystem/1/FILE1, get the inum and then do a

    find / -type f -inum x   # Whatever the inum is
-- 
fedora-list mailing list
fedora-list@xxxxxxxxxx
To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list
[Index of Archives]     [Older Fedora Users]     [Fedora Announce]     [Fedora Package Announce]     [EPEL Announce]     [Fedora Magazine]     [Fedora News]     [Fedora Summer Coding]     [Fedora Laptop]     [Fedora Cloud]     [Fedora Advisory Board]     [Fedora Education]     [Fedora Security]     [Fedora Scitech]     [Fedora Robotics]     [Fedora Maintainers]     [Fedora Infrastructure]     [Fedora Websites]     [Anaconda Devel]     [Fedora Devel Java]     [Fedora Legacy]     [Fedora Desktop]     [Fedora Fonts]     [ATA RAID]     [Fedora Marketing]     [Fedora Management Tools]     [Fedora Mentors]     [SSH]     [Fedora Package Review]     [Fedora R Devel]     [Fedora PHP Devel]     [Kickstart]     [Fedora Music]     [Fedora Packaging]     [Centos]     [Fedora SELinux]     [Fedora Legal]     [Fedora Kernel]     [Fedora OCaml]     [Coolkey]     [Virtualization Tools]     [ET Management Tools]     [Yum Users]     [Tux]     [Yosemite News]     [Gnome Users]     [KDE Users]     [Fedora Art]     [Fedora Docs]     [Asterisk PBX]     [Fedora Sparc]     [Fedora Universal Network Connector]     [Libvirt Users]     [Fedora ARM]

  Powered by Linux