Tag Info

Hot answers tagged

53

You can find inode number for your file with ls -i and ls -l shows references count (number of hardlinks to particular inode) after you found inode number, you can search for all files with same inode: find . -inum NUM will show filenames for inode NUM in current dir (.)


40

Please note that the only unfortunate difference is that you need Administrator rights to create symbolic links. IE, you need an elevated prompt. (A workaround is the SeCreateSymbolicLinkPrivilege can be granted to normal Users via secpol.msc.) Note in terminology: Windows shortcuts are not called "symlinks"; they are shell links, as they are simply files ...


26

In this answer I will attempt to outline what the different types of links in directory management are as well as why they are useful as well as when they could be used. When trying to achieve a certain organization on your file volumes, knowing the various different types as well as creating them is valuable knowledge. For information on how a certain link ...


22

You can use the mklink command like : mklink /H <link> <target> I guess that should work, but I don't know what would happen if you use eMule on the same time at two different locations regarding the syncing.


21

There isn't really a well-defined answer to your question. Unlike symlinks, hardlinks are indistinguishable from the original file. Filenames in directories are just references to an inode (which contains the file contents and file attributes). Creating a hard link creates another reference to the same inode. These references are unidirectional (in typical ...


16

Hard links can only be used for files, not directories. References: MSDN: Hard Links and Junctions, <1>, and <2>


14

To use an analogy from mail delivery, a symbolic link is something like a forwarding address... when something tries to open a symbolic link, it opens the "file" (not literally a file, though) stored there, and sees that it should instead look at a file with a different name, so it opens the other file instead. A hard link is more like having two addresses ...


14

The reason for this behavior is rather straightforward, and it relates to how files are saved in most Mac OS X applications: Atomically. What happens is that a copy of the file is written to a temporary staging area, and then moved to replace the original file. This, quite naturally, breaks hard links.


13

UNIX has hard links and symbolic links (made with "ln" and "ln -s" respectively). Symbolic links are simply a file that contains the real path to another file and can cross filesystems. Hard links have been around since the earliest days of UNIX (that I can remember anyway, and that's going back quite a while). They are two directory entries that reference ...


13

It's not about the GUI, it's specifically about TextEdit's strategy for saving changes: it does not write in place on the existing file, but rather it first writes a new one, and when that's completed it removes the old one and renames the new one to the old one's names. Many editors (programs that conceptually alter a file "in place"), GUI or not, use this ...


13

All files are hard links, with link counts of at least 1. This is why the files look the same. They are the same. What you seem to be looking for are files where there are more than one link to the file. There's very little that distinguishes a file with a link count greater than one from a file with a link count of one … except the link count ...


12

ls -l The first column will represent permissions. The second column will be the number of sub-items (for directories) or the number of paths to the same data (hard links, including the original file) to the file. Eg: -rw-r--r--@ 2 [username] [group] [timestamp] HardLink -rw-r--r--@ 2 [username] [group] [timestamp] Original ...


10

When you create a hardlink, you are creating two separate file system entries pointing to the same physical data on the disk. When you do a dir, it displays the size of the data being stored at the location the file system entry is pointing at. So if you create 100 hard links to a single file, they will all report the same size - they are reporting the ...


8

If you're on Windows Vista or later, and have admin rights, you might check out the mklink command (it's a command line tool). I'm not sure how symlink-y it actually is since windows gives it the little arrow icon it puts on shortcuts, but a quick notepad++ test on a text file suggests it might work for what you're looking for. You can run mklink with no ...


8

Try this with GNU find: find /start/dir -L -samefile /file/to/check -exec ls -li {} \; Example output: 1234704 -rw-r--r-- 2 user1 user1 1134 2009-09-11 11:12 ./x1 1234704 -rw-r--r-- 2 user1 user1 1134 2009-09-11 11:12 ./x2 1234983 lrwxrwxrwx 1 user1 user1 2 2009-10-31 16:56 ./testx -> x1 2345059 lrwxrwxrwx 1 user2 user2 2 2010-01-03 16:17 ./x3 -> ...


8

When you save a file on an NTFS filesystem, it creates the file somewhere on the drive, then creates a reference to it in the Master File Table (MFT). When a program requests a file, Windows looks in the MFT for the filename, and if found, returns the information the filename points to. A hard link takes an existing file (or folder) and creates another, ...


7

Hard link is just another name for a file. If you have file named A.txt and you have link L.txt, once you delete A.txt, you will still have access to it's data through L.txt. Only when both are deleted file is gone. On other hand, you have a so called soft-link (junction if it is folder or symbolic link if it is file). In that case, when you delete A.txt, ...


7

I think that hard links are for files only and not directories.


7

A hard link is a file system feature that cannot cross a file system boundary. You can't hard link files on C: to D: because they are separate file systems. They might each contain the same type of file sytem (eg. NTFS) but they are separate file systems.


7

You cannot remove/disable/or inhibit the functionality of links in NTFS. It's a feature of the base file-system. I am a bit curious as to why you're wanting to disable them. Symbolic & Hard links both have been used for decades in varying forms. As far as exploitability goes... if a virus/hacker/??? can get access to the file system with sufficient ...


7

Do an ls -ld . of the directory containing the hard link. If you own the directory (or have 'w' permission) you should be able to delete it. If the directory (i.e. /tmp) has the 't' (sticky bit) set, then you will be unable to delete this link as you are not the owner of the file. Next time use ln -s (a symbolic link). ACLs might also prevent you from file ...


6

Since the only other answer doesn't really "fix" the issue, just acknowledges it, I think it's worth saying I had this same issue, and discovered the problem. The issue for me was relative vs absolute symlinks. I use Link Shell Extension. When creating absolute symlinks, Explorer works fine. When creating relative links, Explorer chokes on them. I can ...


6

Try using Sysinternals Disk Usage (otherwise know as du), specifically using the -u and -v flags will only count unique occurrences, and will show the usage of each folder as it goes along. As far as I know the file system doesn't show the difference between the original file and a hard link (that is really the point of a hard link) so you can't discount ...


6

This happens when the editor saves to a temporary file, removes the original, then renames the temporary file. Not all editors follow this behavior, but most do for reliability reasons. And making it a hard link won't help since the link would be erased regardless.


5

Check out the HLScan tool from MS. "Displays hard links on an NTFS volume or in specified files or directories of the volume." It's part of the Windows resource kit(s). Here's a direct link to download the Windows 2000 version of JUST that utility (it works on XP). You can probably dig up the XP or 2003 specific Resource kits by searching MS's download ...


5

Well, a little bit more newbie-friendly answer... Some basics beforehand A simple view on how files are stored on UNIX/Linux systems is: There's a directory entry consisting of the name you see with ls -l and an Inode number (you may see with ls -i). The Inode contains the actual information where your data is stored on the filesystem (among other things ...


5

As grawity says, the second "reset" is either poor writing or an outright mistake. Isn't the statement attributes on the file are reflected in every hard link to that file equivalent to the statement changes to that file's attributes propagate to all the hard links? No. The article is stating something that is perhaps too much of an implementation ...


5

You can use the /j switch to create a directory hard link. Be careful with the del command. To remove link to directory use the rmdir command, as del will delete all files in the directory the link points to.


5

There is a way to make backups like you say, but I don't believe with Robocopy alone. There are several programs that will hard link or dedupe backups, and be space efficient. Here are a few programs I've used or ran across: Dupemerge - free - While not a "backup program" it is a bulk hard linker. hardlink backup - free for personal use - uses hard links ...



Only top voted, non community-wiki answers of a minimum length are eligible