Pergunta de entrevista da empresa Google

Explain between hard link and soft link with in file1

Resposta da entrevista

Sigiloso

6 de dez. de 2016

say below was asked Create two files: $ touch blah1 $ touch blah2 Enter some data into them: $ echo "Cat" > blah1 $ echo "Dog" > blah2 And as expected: $cat blah1; cat blah2 Cat Dog Let's create hard and soft links: $ ln blah1 blah1-hard $ ln -s blah2 blah2-soft Let's see what just happened: $ ls -l blah1 blah1-hard blah2 blah2-soft -> blah2 Changing the name of blah1 does not matter: $ mv blah1 blah1-new $ cat blah1-hard Cat blah1-hard points to the inode, the contents, of the file - that wasn't changed. $ mv blah2 blah2-new $ ls blah2-soft blah2-soft $ cat blah2-soft cat: blah2-soft: No such file or directory