Questions tagged [hard-link]

48 questions
208
votes
5 answers

Why are hard links not allowed for directories?

I am using Ubuntu 12.04. When I try to create a hard link for any directory, it fails. I can create hard links for files inside file system boundary. I know the reason why we cannot create hardlinks for files beyond file system. I tried these…
Nischay
  • 3,603
  • 3
  • 19
  • 24
52
votes
5 answers

Are hard links equivalent to Windows shortcuts?

Wikipedia defines a hard link as: a directory entry that associates a name with a file on a file system. (A directory is itself a special kind of file that contains a list of such entries.) The term is used in file systems which allow multiple…
Computernerd
  • 1,381
  • 5
  • 17
  • 21
15
votes
1 answer

Why is there a .steampath in my home directory?

In the terminal, I see a broken link which is named .steampath, I didn't remove /home/user/.steam/sdk32/steam, but it is gone. Why is the .steampath there? Should I remove it?
JulianLai
  • 1,562
  • 2
  • 15
  • 31
13
votes
4 answers

How to find all hardlinks in a folder?

I have two external disks that has the same files. One is encrypted, the other is not. The encrypted one has a lot less space left than the non encrypted, I now assume that it is because of hardlinks on the non encrypted disks. So I would like to…
Jeno
  • 285
  • 3
  • 13
  • 27
9
votes
2 answers

What are some typical uses of hard links?

Everyone who was used to Windows can imagine what symlinks are and how they're used. On the other hand, the hard link concept is foreign to Windows (am I correct?). I would like to know what are the typical uses to hard links in Linux. I've already…
To Do
  • 15,172
  • 12
  • 70
  • 116
7
votes
2 answers

Colorize hardlinks in ls output?

How can I colorize hardlinks myself? Turns out on an old Ubuntu 10.04 I have, this happens by default (same .bashrc and .profile in use), whereas on the newer Ubuntu 12.04 it doesn't. This is the output on Ubuntu 10.04 (the one I desire): And this…
0xC0000022L
  • 5,656
  • 6
  • 52
  • 91
5
votes
1 answer

Is "mount --bind dir1 dir2" an alternative for hard links for directories?

It's a known fact that you cannot create hard links for directories. My question is whether can one use mount --bind dir1 dir2 instead of creating a hardlink of dir1 to dir2? which can't happen
juggernaut108
  • 73
  • 1
  • 3
4
votes
2 answers

Nautilus - no support for hard links?

I finally got round to studying and understanding hard links in my quest to check I have understood the basics, of which I have managed to skip a lot of. After realizing how brilliant they are, I wonder why there isn't better support for them in…
Programster
  • 5,731
  • 20
  • 63
  • 92
4
votes
2 answers

Does dropbox sync hardlinks?

I have a folder of large files. I want that folder to be in two different places at once - my Home documents, and my College documents folder. I've done this with a symlink in the College folder to the Home folder. Unfortunately, Dropbox syncs my…
Tim
  • 32,274
  • 27
  • 118
  • 177
4
votes
2 answers

Script Remove All hardlinks for a specific file

I want to delete all hardlinks for a specific file. The usage would be script somefile, this would count the hardlinks for the file somefile, then it's going to delete all hardlinks keeping this file only. The command find / -samefile file-name |…
Maythux
  • 82,867
  • 54
  • 239
  • 271
3
votes
1 answer

Default number of links for directory?

I know that hard link can not point to directories but when i create an empty directory and execute stat command for it links=2 ,I search for symbolic links There is not another link. why for directory the default numbers of links=2?
Sinoosh
  • 2,001
  • 2
  • 19
  • 32
3
votes
1 answer

When would you want to use a Hard link instead of a soft link? An example to help Understand the difference

I have read lots of posts on What is the difference between soft and hard link but still am a bit vague on the difference. I wonder could somebody give just one or two example(s) of when you would want to use a Hard link instead of a soft? Just a…
FreeSoftwareServers
  • 1,109
  • 1
  • 13
  • 31
3
votes
2 answers

What happens when you make a hard link to a file in /mnt, and then unmount?

As far as I know, hard links will not break when a file is deleted. Because the file will remain to exist. But what happens when you mount a file system to /mnt for example, create a hard link to a file on that volume, unmount the volume, and then…
foxite
  • 451
  • 2
  • 9
  • 25
3
votes
0 answers

16.04: File with no hardlink

I have a directory with these files on an Ubuntu 16.04 server: -rwxrwxrwx 1 nobody nogroup 162034 Apr 1 2019 accounts.log -rwxrwxrwx 1 nobody nogroup 2336191 Apr 17 2019 app.access.log -rwxrwxrwx 1 nobody nogroup 109801 Apr 17 2019…
Lucas B
  • 131
  • 2
2
votes
2 answers

List all files with multiple hardlinks and related path

How can I list all files with hardlinks and the associated paths? It should be a sorted list, by the inode ID. EDIT: sure, I mean all files with a hardlink number >=2 I thought about a list like INODE_ID FILEPATH 1234 /tmp/test1 1234…
2IRN
  • 695
  • 1
  • 7
  • 14
1
2 3 4