« first day (1929 days earlier)      last day (3025 days later) » 

10:59 AM
Heh, I was feeling good about myself since, apparently, I have outscored Stéphane 33 times. I then made the mistake of checking the inverse and he has outscored me 72. Oh well... :)
 
hi o/
can /bin/ and /bin have different mean?
 
@terdon 33 times is pretty good. And votes don't mean that much, anyway.
 
@edwardtorvalds I don't understand the question.
 
@JennyD before I put my actual question, I think you must be knowing that Arch Linux has merged /bin directory with /usr/bin and /bin is now just a symlink for old programs. now the question: readlink /bin/ does not gives any output, but readlink /bin does and it is /usr/bin
 
11:16 AM
@edwardtorvalds So, what you're asking is "is /dir/ and /dir the same thing or not"?
and especially in the context where dir is a symlink.
 
@JennyD I think it is, but today I found the exception so confused
 
I would say it's not.
 
There are a lot of more knowledgeable people here, and they may correct me. But my take on it is that /dir means "the inode that has the name /dir", but but /dir/ means "the directory that the inode points to". in other words, by adding the final slash, you are dereferencing the symlink and going to the actual directory.
And I may be explaining this all wrong; it's clear in my head, but I'm not good at putting it into words.
 
maybe I should put it as question
 
11:25 AM
@FaheemMitha They certainly don't.
terdon@oregano ~ $ stat /bin
  File: ‘/bin’ -> ‘usr/bin’
  Size: 7         	Blocks: 0          IO Block: 4096   symbolic link
Device: 802h/2050d	Inode: 12          Links: 1
Access: (0777/lrwxrwxrwx)  Uid: (    0/    root)   Gid: (    0/    root)
Access: 2016-01-19 18:11:06.268226553 +0200
Modify: 2015-09-30 22:17:54.000000000 +0300
Change: 2015-12-12 02:46:43.961060828 +0200
 Birth: -
terdon@oregano ~ $ stat /bin/
  File: ‘/bin/’
  Size: 90112     	Blocks: 184        IO Block: 4096   directory
Device: 802h/2050d	Inode: 526275      Links: 5
@edwardtorvalds ^^
What @JennyD said. /bin points to the link itself, a special file whose inode is 12. /bin/ and /usr/bin/ are the same thing, with the same inode: 526275.
So is /usr/bin.
 
@terdon if /bin points to itself then why readlink is giving output that it is supposed to give for /bin/ since /bin/ points to /usr/bin ?
 
@edwardtorvalds Because that's readlink's job. You're asking it to tell you what the link /bin points to. To put it differently, /bin is a link to /usr/bin/ but /bin/ is /usr/bin, not a link to it.
 
@terdon Well put
 
@terdon oh K, but tough to digest :-/
@terdon I think this is an interesting point, so I made a question out of it, so please answer it for other users
0
Q: difference between /dir and /dir/

edward torvaldsConsider a symlink I am making to my Music directory named music. ln -s Music music now consider following sequence of commands: edward@ArchLinux:~$ readlink music Music edward@ArchLinux:~$ readlink music/ edward@ArchLinux:~$ I am getting output only if I am not using / at the end of symli...

@terdon may I ask how or why (still not satisfied with the logic, although you are right)
 
How or why what?
Perhaps this might help:
 
11:33 AM
why it is so? or how it is so?
 
terdon@oregano ~ $ file /bin
/bin: symbolic link to usr/bin
terdon@oregano ~ $ file /bin/
/bin/: directory
 
I mean how putting / at the end changes it to directory?
 
@edwardtorvalds It doesn't change it as such. It just causes the link to be followed to its target.
 
ls does not differentiate between them
 
No.
 
11:37 AM
@terdon why? according to your explaination ls should consider /bin as just file and not follow it
 
Dunno, ask the developers of ls.
 
Presumably, because that's what ls does. When you give it a directory, it will list the directory's contents, not the directory. In the same way, when you give it a link, it reads the link's target.
But the main point is that there are two things here. The link and the link's target. Each of these is a different file (everything is a file). You can also see this with find:
$ find / -maxdepth 1 -inum 12
/bin
$ find / -maxdepth 2 -inum 526275 2>/dev/null
/usr/bin
Two different things with two different inodes. How the different programs choose to deal with this is up to the developers of the programs. ls will automatically follow it. Others will not. du for example:
$ du -sh /bin
0	/bin
$ du -sh /bin/
364M	/bin/
But, if we tell it to dereference links:
 
@terdon thanks, please copy paste your chat answer to my question?
 
$ du -Lsh /bin
399M	/bin
@edwardtorvalds Can't now. I'll try when I have some time later today.
 
11:43 AM
@terdon ok, please do so, please dont forget to mention how other commands behave
 
 
2 hours later…
2:03 PM
just achieved 3k!
 
@Pandya congratulations!
 
@JeffSchaller Thanks
And participated in a closing review of question
 
 
2 hours later…
3:37 PM
@cuonglm BTW, which OS do you use?
 
4:14 PM
@Pandya: On GNU/Linux systems
at least FreeBSD and MacOSX xargs do not have -0
 
4:26 PM
@cuonglm Wow, that's a term one does not see used very often.
 
@Pandya: Sorry, I mean -d
 

« first day (1929 days earlier)      last day (3025 days later) »