Linux command pwd : Print Working Directory

  • Updated : 21-06-2024 03:44
  • By : Phosphataz
  • pwd command description


    pwd means print working directory or show the current directory you are in. It's a shell built-in or internal command. The command is useful specially when you have a logical or symlink in the path.


    pwd command syntax


    pwd [OPTIONS]
    


    Command with options


    There is 2 options :

    • -L to revel the logical path if there is. For example, type these commades code in terminal :
    # go in tmp and create folder 
    cd /tmp
    mkdir folder
    
    # make a symlink to folder you created
    ln -s folder/ folder1
    
    # go inside folder1
    cd folder1
    
    # type command and add this option -L :
    pwd -L
    

    In this case the result will be the path to the logical.


    • -P to revel the physical path if there is. In the previous example, use this option to get the physical path :
    # type command and add this option -P :
    pwd -P
    

    In this case the result will be the path to the physical path.


    Conclusion


    This is all for the pwd command. Check here for more Linux ressource.