Why pwd does not accept long options like --physical?












3















When I display the manual for pwd command, it says that long options like --physical are supported



$ man pwd
PWD(1) User Commands PWD(1)

NAME
pwd - print name of current/working directory

SYNOPSIS
pwd [OPTION]...

DESCRIPTION
Print the full filename of the current working directory.

-L, --logical
use PWD from environment, even if it contains symlinks

-P, --physical
avoid all symlinks


However, it fails when I type the following



$ pwd --physical
-bash: pwd: --: invalid option
pwd: usage: pwd [-LP]


Why are long options not working for me?



I'm using RHEL 6.4. No alias for pwd is configured. Looks like it's standard pwd:



$ which pwd
/bin/pwd









share|improve this question




















  • 1





    The manual page is for a standalone utility which is not part of bash.

    – Thomas Dickey
    4 hours ago






  • 4





    Use type instead of which, since which only shows commands, while type shows keywords, builtins, aliases, functions, and commands (and hashed command paths). For more details see Why not use “which”? What to use then?

    – wjandrea
    3 hours ago
















3















When I display the manual for pwd command, it says that long options like --physical are supported



$ man pwd
PWD(1) User Commands PWD(1)

NAME
pwd - print name of current/working directory

SYNOPSIS
pwd [OPTION]...

DESCRIPTION
Print the full filename of the current working directory.

-L, --logical
use PWD from environment, even if it contains symlinks

-P, --physical
avoid all symlinks


However, it fails when I type the following



$ pwd --physical
-bash: pwd: --: invalid option
pwd: usage: pwd [-LP]


Why are long options not working for me?



I'm using RHEL 6.4. No alias for pwd is configured. Looks like it's standard pwd:



$ which pwd
/bin/pwd









share|improve this question




















  • 1





    The manual page is for a standalone utility which is not part of bash.

    – Thomas Dickey
    4 hours ago






  • 4





    Use type instead of which, since which only shows commands, while type shows keywords, builtins, aliases, functions, and commands (and hashed command paths). For more details see Why not use “which”? What to use then?

    – wjandrea
    3 hours ago














3












3








3








When I display the manual for pwd command, it says that long options like --physical are supported



$ man pwd
PWD(1) User Commands PWD(1)

NAME
pwd - print name of current/working directory

SYNOPSIS
pwd [OPTION]...

DESCRIPTION
Print the full filename of the current working directory.

-L, --logical
use PWD from environment, even if it contains symlinks

-P, --physical
avoid all symlinks


However, it fails when I type the following



$ pwd --physical
-bash: pwd: --: invalid option
pwd: usage: pwd [-LP]


Why are long options not working for me?



I'm using RHEL 6.4. No alias for pwd is configured. Looks like it's standard pwd:



$ which pwd
/bin/pwd









share|improve this question
















When I display the manual for pwd command, it says that long options like --physical are supported



$ man pwd
PWD(1) User Commands PWD(1)

NAME
pwd - print name of current/working directory

SYNOPSIS
pwd [OPTION]...

DESCRIPTION
Print the full filename of the current working directory.

-L, --logical
use PWD from environment, even if it contains symlinks

-P, --physical
avoid all symlinks


However, it fails when I type the following



$ pwd --physical
-bash: pwd: --: invalid option
pwd: usage: pwd [-LP]


Why are long options not working for me?



I'm using RHEL 6.4. No alias for pwd is configured. Looks like it's standard pwd:



$ which pwd
/bin/pwd






bash rhel pwd






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited 2 hours ago









wjandrea

478413




478413










asked 4 hours ago









Michal KordasMichal Kordas

1316




1316








  • 1





    The manual page is for a standalone utility which is not part of bash.

    – Thomas Dickey
    4 hours ago






  • 4





    Use type instead of which, since which only shows commands, while type shows keywords, builtins, aliases, functions, and commands (and hashed command paths). For more details see Why not use “which”? What to use then?

    – wjandrea
    3 hours ago














  • 1





    The manual page is for a standalone utility which is not part of bash.

    – Thomas Dickey
    4 hours ago






  • 4





    Use type instead of which, since which only shows commands, while type shows keywords, builtins, aliases, functions, and commands (and hashed command paths). For more details see Why not use “which”? What to use then?

    – wjandrea
    3 hours ago








1




1





The manual page is for a standalone utility which is not part of bash.

– Thomas Dickey
4 hours ago





The manual page is for a standalone utility which is not part of bash.

– Thomas Dickey
4 hours ago




4




4





Use type instead of which, since which only shows commands, while type shows keywords, builtins, aliases, functions, and commands (and hashed command paths). For more details see Why not use “which”? What to use then?

– wjandrea
3 hours ago





Use type instead of which, since which only shows commands, while type shows keywords, builtins, aliases, functions, and commands (and hashed command paths). For more details see Why not use “which”? What to use then?

– wjandrea
3 hours ago










2 Answers
2






active

oldest

votes


















11














bash has a built-in command pwd which is what you are using when you simply type pwd into your shell.



To get the pwd as described by the manpage, you need force use of the external command. You can do this by specifying the full path to the executable (/bin/pwd in your case) or by prepending env before the line: env pwd, which starts the env command which can be used to add settings to the environment (but which is not done here) and then env starts the command specified. As env doesn't have a builtin pwd, the "real" /bin/pwd is executed.



The advantage of the builtin pwd in bash is that bash keeps track of the current directory, so getting the value is at zero cost, whereas the external command needs to search up through the filesystem to determine the path, which is much more IO intensive.






share|improve this answer
























  • That's not how the external command actually works. unix.stackexchange.com/a/413225/5132

    – JdeBP
    1 hour ago



















7














That manpage documents /bin/pwd, but when you run pwd you’re using the shell built-in; see the output of



type pwd


Your shell’s built-in pwd doesn’t support long options (see your shell’s documentation; since you’re using Bash, help pwd will provide a summary).






share|improve this answer

























    Your Answer








    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "106"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: false,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: null,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f495790%2fwhy-pwd-does-not-accept-long-options-like-physical%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    2 Answers
    2






    active

    oldest

    votes








    2 Answers
    2






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    11














    bash has a built-in command pwd which is what you are using when you simply type pwd into your shell.



    To get the pwd as described by the manpage, you need force use of the external command. You can do this by specifying the full path to the executable (/bin/pwd in your case) or by prepending env before the line: env pwd, which starts the env command which can be used to add settings to the environment (but which is not done here) and then env starts the command specified. As env doesn't have a builtin pwd, the "real" /bin/pwd is executed.



    The advantage of the builtin pwd in bash is that bash keeps track of the current directory, so getting the value is at zero cost, whereas the external command needs to search up through the filesystem to determine the path, which is much more IO intensive.






    share|improve this answer
























    • That's not how the external command actually works. unix.stackexchange.com/a/413225/5132

      – JdeBP
      1 hour ago
















    11














    bash has a built-in command pwd which is what you are using when you simply type pwd into your shell.



    To get the pwd as described by the manpage, you need force use of the external command. You can do this by specifying the full path to the executable (/bin/pwd in your case) or by prepending env before the line: env pwd, which starts the env command which can be used to add settings to the environment (but which is not done here) and then env starts the command specified. As env doesn't have a builtin pwd, the "real" /bin/pwd is executed.



    The advantage of the builtin pwd in bash is that bash keeps track of the current directory, so getting the value is at zero cost, whereas the external command needs to search up through the filesystem to determine the path, which is much more IO intensive.






    share|improve this answer
























    • That's not how the external command actually works. unix.stackexchange.com/a/413225/5132

      – JdeBP
      1 hour ago














    11












    11








    11







    bash has a built-in command pwd which is what you are using when you simply type pwd into your shell.



    To get the pwd as described by the manpage, you need force use of the external command. You can do this by specifying the full path to the executable (/bin/pwd in your case) or by prepending env before the line: env pwd, which starts the env command which can be used to add settings to the environment (but which is not done here) and then env starts the command specified. As env doesn't have a builtin pwd, the "real" /bin/pwd is executed.



    The advantage of the builtin pwd in bash is that bash keeps track of the current directory, so getting the value is at zero cost, whereas the external command needs to search up through the filesystem to determine the path, which is much more IO intensive.






    share|improve this answer













    bash has a built-in command pwd which is what you are using when you simply type pwd into your shell.



    To get the pwd as described by the manpage, you need force use of the external command. You can do this by specifying the full path to the executable (/bin/pwd in your case) or by prepending env before the line: env pwd, which starts the env command which can be used to add settings to the environment (but which is not done here) and then env starts the command specified. As env doesn't have a builtin pwd, the "real" /bin/pwd is executed.



    The advantage of the builtin pwd in bash is that bash keeps track of the current directory, so getting the value is at zero cost, whereas the external command needs to search up through the filesystem to determine the path, which is much more IO intensive.







    share|improve this answer












    share|improve this answer



    share|improve this answer










    answered 4 hours ago









    wurtelwurtel

    10.2k11426




    10.2k11426













    • That's not how the external command actually works. unix.stackexchange.com/a/413225/5132

      – JdeBP
      1 hour ago



















    • That's not how the external command actually works. unix.stackexchange.com/a/413225/5132

      – JdeBP
      1 hour ago

















    That's not how the external command actually works. unix.stackexchange.com/a/413225/5132

    – JdeBP
    1 hour ago





    That's not how the external command actually works. unix.stackexchange.com/a/413225/5132

    – JdeBP
    1 hour ago













    7














    That manpage documents /bin/pwd, but when you run pwd you’re using the shell built-in; see the output of



    type pwd


    Your shell’s built-in pwd doesn’t support long options (see your shell’s documentation; since you’re using Bash, help pwd will provide a summary).






    share|improve this answer






























      7














      That manpage documents /bin/pwd, but when you run pwd you’re using the shell built-in; see the output of



      type pwd


      Your shell’s built-in pwd doesn’t support long options (see your shell’s documentation; since you’re using Bash, help pwd will provide a summary).






      share|improve this answer




























        7












        7








        7







        That manpage documents /bin/pwd, but when you run pwd you’re using the shell built-in; see the output of



        type pwd


        Your shell’s built-in pwd doesn’t support long options (see your shell’s documentation; since you’re using Bash, help pwd will provide a summary).






        share|improve this answer















        That manpage documents /bin/pwd, but when you run pwd you’re using the shell built-in; see the output of



        type pwd


        Your shell’s built-in pwd doesn’t support long options (see your shell’s documentation; since you’re using Bash, help pwd will provide a summary).







        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited 3 hours ago

























        answered 4 hours ago









        Stephen KittStephen Kitt

        168k24378455




        168k24378455






























            draft saved

            draft discarded




















































            Thanks for contributing an answer to Unix & Linux Stack Exchange!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f495790%2fwhy-pwd-does-not-accept-long-options-like-physical%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            How to label and detect the document text images

            Vallis Paradisi

            Tabula Rosettana