declone(1)

πŸ“¦
this version Β· 2 versions
, in debian bookworm, debian trixie, opensuse-leap 16.0, ubuntu jammy, ubuntu noble, ubuntu questing

✨ NAME ✨

declone β€” bestie's lil tool for breaking hardlinks πŸ’…


πŸ¦‹ SYNTAX πŸ¦‹

declone file...

πŸ’– DESCRIPTION πŸ’–

Okay so listen. You know how ln(1) or hardlink(1) can make a hard link, right? Same inode, two names, one file, iconic behavior, they're literally sharing a vibe. declone says "not anymore, sweetie" and breaks that hard link for you. πŸŽ€

Here's the tea on what it actually does: it makes a copy of the file's contents, plus the ownership information, plus the standard permissions. That's it. That's the whole list.

⚠️ Important, no cap: it does not copy ACLs or SELinux contexts. So if you've got fancy access control going on, those bits are staying behind, bestie. 😭

🌸 EXAMPLE 🌸

Let's set the scene. Two hardlinks, made the old-fashioned way:

$ ln GNUmakefile new1
$ ln GNUmakefile new2
$ ls -li GNUmakefile new1 new2
-rw-r--r--  3 jengelh users 2687 May 27 23:11 GNUmakefile
-rw-r--r--  3 jengelh users 2687 May 27 23:11 new1
-rw-r--r--  3 jengelh users 2687 May 27 23:11 new2

See that link count of 3? They're all holding hands. 🀝 Now watch declone do its little magic trick:

$ declone new2
* new2

And boom, check it now:

$ ls -li GNUmakefile new1 new2
-rw-r--r--  2 jengelh users 2687 May 27 23:11 GNUmakefile
-rw-r--r--  2 jengelh users 2687 May 27 23:11 new1
-rw-r--r--  1 jengelh users 2687 May 28 09:10 new2

new2 said "I'm my own file now" β€” link count dropped to 1, and look at that timestamp, May 28 09:10 instead of May 27 23:11, because it's a fresh copy living its main character era. 🌟 The other two are still at 2, still linked to each other, which is exactly right. Slay. πŸ‘‘


🫢 SEE ALSO 🫢

hxtools(7)


And that's a wrap, bestie!! πŸ’œ This lil page came to you from the hxtools collection, dated 2008-02-06 β€” vintage but still eating, fr fr. Go forth and declone responsibly, mwah πŸŽ€βœ¨πŸ’–

πŸ“¦ where this page comes from