Skip to main content
13 events
when toggle format what by license comment
May 6, 2018 at 1:23 comment added jthill What you're thinking of as "the linked file" is actually two things, the file itself and a link to it. touch newf makes a file and a link to it, ln newf link makes another link to the same file, this one named link. The two links are indistinguishable peers. You can put them in different places in the filesystem, with different permissions on (the paths to) the directories that hold them, but the links themselves have no attributes other than their arbitrary name and the "inode number" that identifies which actual file in their filesystem is being referred to.
Oct 14, 2015 at 13:07 comment added Mr. Minty Fresh I find it interesting how the hard link becomes the same type as the linked file. Thank you for your answer.
Oct 8, 2015 at 5:42 comment added mikeserv i like you. this is a really good answer, too. thank you.
Oct 8, 2015 at 5:22 comment added jthill @mikeserv See, I can spell pty and pts, and probably even ptmx on a good day, but that's about it. :-) at least the 5,0 node works everywhere I can find, it's the controlling-tty device type. I got it with just ls -l /dev/tty, guess I got lucky there.
Oct 8, 2015 at 5:12 comment added mikeserv if it means any thing, you can almost do it with ttys on linux, but you do at least need to unlockpt() it after < /dev/ptmx. But just doing the latter does create a new pty. i stumbled across that the beginning of this year.
Oct 8, 2015 at 5:04 comment added jthill @mikeserv but to actually answer your question (sorry for the wot), yes, every link is just another way to get to the underlying object.
Oct 8, 2015 at 5:03 comment added jthill @mikeserv A socket's a purely runtime entity. socket() creates an actual socket, bind() gives it a specific name, connect() connects a socket you made to some named socket. Different kinds of sockets use different kinds of names, e.g. Internet sockets use Internet addresses, but they all share common API (including read() and write(), it makes me sad that you can't open() a filesystem socket and have the OS or libc do socket() and connect() for you). man 7 socket has more, all the networking protocols do make for a fidgety manpage.
Oct 8, 2015 at 4:45 comment added mikeserv ok, but maybe i should have made it clearer about how little i know about sockets. i think i understand links well enough and so it just gives the same socket a new name, right? that doesn't have any special significance for sockets or anything, yeah? sorry about my ignorance.
Oct 8, 2015 at 4:43 comment added jthill @mikeserv It's the make-a-socket program above, it just drops a socket link named "socket" in its current directory.
Oct 8, 2015 at 4:41 comment added mikeserv what does ./tsock actually do, anyway?
Oct 8, 2015 at 4:30 history edited jthill CC BY-SA 3.0
only non-symbolic links keep inodes around
Oct 7, 2015 at 19:09 history edited jthill CC BY-SA 3.0
added 69 characters in body
Oct 7, 2015 at 19:04 history answered jthill CC BY-SA 3.0