Linux - NewbieThis 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
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.
Hello.
Can anyone tell the different between "Physical", "Relative" and "Symbolic" links? I guess "Symbolic" link is a regular link like "shortcut" in Windows OS and "Physical" link is a link that if you change the link then it applied to real location?
Without dragging M$ into the picture to muddy the water, there are hard links and symbolic links. There are no other kinds.
Hardlinks are where more than one name points to the same file, via its inode, but only files. The cannot span file systems and when the last link to the file is removed, the file is deleted. Symbolic links can be either directories or files, as they are a name not a hard link, and the name is interpreted on the fly. They can span file systems.
See
Code:
man ln
man 2 link
man 2 symlink
Last edited by Turbocapitalist; 12-24-2017 at 07:53 AM.
Distribution: openSUSE, Raspbian, Slackware. Previous: MacOS, Red Hat, Coherent, Consensys SVR4.2, Tru64, Solaris
Posts: 2,808
Rep:
Quote:
Originally Posted by hack3rcon
Hello.
Can anyone tell the different between "Physical", "Relative" and "Symbolic" links?
The other replies point out that there are only two types of links. As for "relative" links... can you point to a place where these are mentioned? The only way I can think of for a link being referred to as "relative" is when it "points" to a location or file by not using an absolute path, i.e.:
Code:
ln -s ../../some-file link-to-some-file
But the contents of /etc/init.d/rc*.d are full of entries like this and they're always referred to as symbolic links.
the pair of relative is: absolute: a path can be either relative or absolute. But it is not related to links anyhow (so symbolic link can be either relative or absolute, hard link is a hard link to an inode, relative/absolute is out of scope here, not relevant)
Without dragging M$ into the picture to muddy the water, there are hard links and symbolic links. There are no other kinds.
Hardlinks are where more than one name points to the same file, via its inode, but only files. The cannot span file systems and when the last link to the file is removed, the file is deleted. Symbolic links can be either directories or files, as they are a name not a hard link, and the name is interpreted on the fly. They can span file systems.
See
Code:
man ln
man 2 link
man 2 symlink
What does "where more than one name points to the same file" mean?
And. Do not think or use SPYWARE 95 terms in linux. Spyware 95 refers to the same user interface since windows 3.11, same flaws. linux is not windows. It is something different.
I'm certain there are several tutorials or books which explain that.
I also read different sources until I get the idea behind it.
Quote:
What does "where more than one name points to the same file" mean?
Quote:
Hardlinks are where more than one name points to the same file, via its inode, but only files.
I suggest that you start reading some books or documentations. Introduction to the shell and linux for example!
It is perfectly explained. Same as with other stuff. look up every word which is unknown.
The (Windows) NTFS filesystem has a different architecture and therefore a different way of doing some things.
A "symbolic" link is basically "a tiny file with a file-name (and directory path) in it," specially marked to indicate that it is a symlink. When resolving the path, the operating system reads the symlink's contents and textually substitutes its contents.
The resulting filename-lookup may not succeed! You can create a symlink to a nonexistent resource, or to one that is subsequently deleted. (This is by design.)
"Hard" links are "multiple directory entries which literally refer to the same underlying file-structure." Their implementation is much more specific to Linux/Unix, because they have to do with the underlying disk architectures. NTFS's architecture and therefore concept is different "by design." Each underlying file-structure object ("inode") contains a count of the number of hard-links which refer to it, so the object won't be deallocated by the filesystem until the last remaining hard-link goes away. (The file's primary directory entry is, if you will, "hard link #1.")
The two types of "links," although similarly-named, are really conceived for entirely parallel purposes. Symlinks are far, far more commonly used.
Some GUIs also implement what they call "shortcuts," and these contain additional information – known to the GUI – which allows the GUI to display an appropriate icon and so-on. But this term is particularly ambiguous in its meaning among different operating systems. ("Link," for some reason, is less so.)
Last edited by sundialsvcs; 12-25-2017 at 08:39 AM.
(The file's primary directory entry is, if you will, "hard link #1.")
None of a file's hard links is any more "primary" than any other. That's a common misconception. They all have equivalent status. Of course there must have been one link that was created first, but that distinction is lost as soon as another hard link is created, and in fact that first link that a file had might no longer exist.
To understand hard links, you need to understand Unix filesystems. Every Unix file consists of an inode and one or more blocks. The blocks contain the data -- the information stored in the file. The inode contains the metadata -- information about the file: who owns it, how big it is, its access permissions, etc. There is also a set of pointers, direct or indirect, to all the blocks in the file. So once the kernel has the inode, it can read all the data.
One thing inodes do not contain is the filename. Filenames are stored in directories, not inodes. In fact a Unix directory is just a specialised file mapping filenames to inodes. That mapping is called a "hard link". As other posters have pointed out, an inode can legally be hard-linked to more than one filename, and this is a completely symmetrical arrangement. The file is equally accessible via either name. If either is deleted, the file remains accessible via the other. Symbolic links, on the other hand, are asymmetrical: the link refers to the original file by name. If that original file is deleted, the link becomes inoperative.
The content of a file is never deleted as long as there is at least one hard link to it, and that can be very useful. Libraries dynamically linked to a running program and data files currently being accessed acquire extra hard links so that they can't just disappear. The name may disappear from the directory, but programs currently using the data can continue to do so until they exit. That breaks the links and, when the link count has fallen to zero, the data blocks and inode are recycled.
if you remove a hard link, the counter of the links (of that file) will be decreased. The file will only be removed when the counter is equal to zero. Otherwise just the directory entry will be removed, nothing else.
If you remove "Hard link" then the real file deleted but it need few space.
The file is not actually deleted until all hard links have been removed (link count becomes zero) and the file is not currently held open by any process.
I have no idea what you mean by, "but it need few space."
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.