0

I created a directory del1 a directory inside tha tas del2 inside that as del3 inside that as del4.I linked these directories as follows

midhun@midhun-Vostro-15-3568:~$ln -s /home/midhun/del1 zero
midhun@midhun-Vostro-15-3568:~$ln -s /home/midhun/del1/del2 one
midhun@midhun-Vostro-15-3568:~$ln -s /home/midhun/del1/del2/del3 two
midhun@midhun-Vostro-15-3568:~$ln -s /home/midhun/del1/del2/del3/del4   three

But when i try to print logical working directory of three and physical working directory of three i getting terminal output as

midhun@midhun-Vostro-15-3568:~$ pwd -P three
/home/midhun
midhun@midhun-Vostro-15-3568:~$ pwd -L three
/home/midhun

My doubt is shouldn't I get physical print working directory output as /home/midhun and logical working directory output as /home/midhun/del1/del2/del3/ . I am confused about this .Please elaborate on this

0

The pwd command will display the logical/physical pathname of the current working directory, not of a directory given on its command line (it should have given you some sort of diagnostic message about this).

To see the -L and -P flags in action, cd into the three directory (the link you created) and try pwd -P and pwd -L.

  • So you mean i should have tried something like this.. midhun@midhun-Vostro-15-3568:~$ cd -L three midhun@midhun-Vostro-15-3568:~/three$ pwd -P /home/midhun/del1/del2/del3/del4 midhun@midhun-Vostro-15-3568:~/three$ pwd -L /home/midhun/three Now it is crear thanks for your fast response. – Samuel Thomson Aug 21 '18 at 10:46
  • @SamuelThomson Not quite. The pwd command only takes the options -L or -P, but nothing else. It will give you the physical/logical working directory (the pathname of the directory that you are in). Don't give a pathname to pwd on the command line. – Kusalananda Aug 21 '18 at 11:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.