How to show full path of a file including the full filename in Mac OSX terminal?












33















'ls' can show the file name, e.g



ls config.inc.php
config.inc.php


'pwd' show current folder full path, e.g



pwd
/Application/XAMPP/xamppfiles/phpmyadmin


Is there a command can put them together, would be able to show:



/Application/XAMPP/xamppfiles/phpmyadmin/config.inc.php









share|improve this question



























    33















    'ls' can show the file name, e.g



    ls config.inc.php
    config.inc.php


    'pwd' show current folder full path, e.g



    pwd
    /Application/XAMPP/xamppfiles/phpmyadmin


    Is there a command can put them together, would be able to show:



    /Application/XAMPP/xamppfiles/phpmyadmin/config.inc.php









    share|improve this question

























      33












      33








      33


      5






      'ls' can show the file name, e.g



      ls config.inc.php
      config.inc.php


      'pwd' show current folder full path, e.g



      pwd
      /Application/XAMPP/xamppfiles/phpmyadmin


      Is there a command can put them together, would be able to show:



      /Application/XAMPP/xamppfiles/phpmyadmin/config.inc.php









      share|improve this question














      'ls' can show the file name, e.g



      ls config.inc.php
      config.inc.php


      'pwd' show current folder full path, e.g



      pwd
      /Application/XAMPP/xamppfiles/phpmyadmin


      Is there a command can put them together, would be able to show:



      /Application/XAMPP/xamppfiles/phpmyadmin/config.inc.php






      macos command-line






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Feb 15 '14 at 0:30









      Rob LRob L

      311137




      311137






















          6 Answers
          6






          active

          oldest

          votes


















          28














          From here:
          https://stackoverflow.com/a/4031502/804713




          macports and homebrew provide a coreutils package containing greadlink
          (GNU readlink). credit to Michael Kallweitt post in mackb.com



          brew install coreutils



          greadlink -f file.txt







          share|improve this answer





















          • 1





            This was driving me nuts. I was thinking why -f wouldn't work on non-GNU and how to make it work. This works. Thanks

            – sdkks
            Oct 13 '17 at 10:14











          • Note that this also works for directories

            – Paul Berg
            Sep 30 '18 at 10:40



















          19














          There are many ways to do that; here is one example that may work for you:



          claw:~ jonv$ echo `pwd`/`ls config.in.php`
          /Users/jonv/config.in.php


          If you want more examples, there are a bunch on this post at stackoverflow.






          share|improve this answer





















          • 1





            Most good answers on in stackoverflow.com/questions/5265702/… don't work out of the box on OS X, however.

            – Quentin Pradet
            Jun 9 '15 at 8:29





















          6














          In Mac OSX, do the following steps:





          1. cd into the directory of the target file.

          2. Type either of the following terminal commands.



          Terminal

          ls "`pwd`/file.txt"
          echo $(pwd)/file.txt



          1. Replace file.txt with your actual file name.

          2. Press Enter.






          share|improve this answer































            2














            You can also use the "find" command for listing all files with complete path:



            find DirectoryName -type f


            or just the following:



            find . -type f





            share|improve this answer
























            • This does not return the absolute path (which seems to be what OP was looking for)

              – Ad N
              Nov 8 '18 at 14:56





















            1














            Didn't like any of the given solutions so I made up my own based off of https://stackoverflow.com/a/22684652/953327



            Create alias which simply is a function call that combines pwd and ls $1. You can then add this to your .bash_profile if you choose.



            alias lsf='function _lsf(){ echo "$(pwd)/$(ls $1)"; };_lsf'


            Example of use:



            lsf registry.lock
            -> /tmp/registry.lock


            I chose lsf for "list full" or "list file", makes sense to me but feel free to modify.






            share|improve this answer































              0














              The following will find a file within the working directory that matches file.txt and return its absolute path



              find `pwd` -name file.txt





              share|improve this answer
























                Your Answer








                StackExchange.ready(function() {
                var channelOptions = {
                tags: "".split(" "),
                id: "3"
                };
                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: true,
                noModals: true,
                showLowRepImageUploadWarning: true,
                reputationToPostImages: 10,
                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%2fsuperuser.com%2fquestions%2f717105%2fhow-to-show-full-path-of-a-file-including-the-full-filename-in-mac-osx-terminal%23new-answer', 'question_page');
                }
                );

                Post as a guest















                Required, but never shown

























                6 Answers
                6






                active

                oldest

                votes








                6 Answers
                6






                active

                oldest

                votes









                active

                oldest

                votes






                active

                oldest

                votes









                28














                From here:
                https://stackoverflow.com/a/4031502/804713




                macports and homebrew provide a coreutils package containing greadlink
                (GNU readlink). credit to Michael Kallweitt post in mackb.com



                brew install coreutils



                greadlink -f file.txt







                share|improve this answer





















                • 1





                  This was driving me nuts. I was thinking why -f wouldn't work on non-GNU and how to make it work. This works. Thanks

                  – sdkks
                  Oct 13 '17 at 10:14











                • Note that this also works for directories

                  – Paul Berg
                  Sep 30 '18 at 10:40
















                28














                From here:
                https://stackoverflow.com/a/4031502/804713




                macports and homebrew provide a coreutils package containing greadlink
                (GNU readlink). credit to Michael Kallweitt post in mackb.com



                brew install coreutils



                greadlink -f file.txt







                share|improve this answer





















                • 1





                  This was driving me nuts. I was thinking why -f wouldn't work on non-GNU and how to make it work. This works. Thanks

                  – sdkks
                  Oct 13 '17 at 10:14











                • Note that this also works for directories

                  – Paul Berg
                  Sep 30 '18 at 10:40














                28












                28








                28







                From here:
                https://stackoverflow.com/a/4031502/804713




                macports and homebrew provide a coreutils package containing greadlink
                (GNU readlink). credit to Michael Kallweitt post in mackb.com



                brew install coreutils



                greadlink -f file.txt







                share|improve this answer















                From here:
                https://stackoverflow.com/a/4031502/804713




                macports and homebrew provide a coreutils package containing greadlink
                (GNU readlink). credit to Michael Kallweitt post in mackb.com



                brew install coreutils



                greadlink -f file.txt








                share|improve this answer














                share|improve this answer



                share|improve this answer








                edited May 23 '17 at 12:41









                Community

                1




                1










                answered Sep 18 '15 at 19:36









                stephenbezstephenbez

                47643




                47643








                • 1





                  This was driving me nuts. I was thinking why -f wouldn't work on non-GNU and how to make it work. This works. Thanks

                  – sdkks
                  Oct 13 '17 at 10:14











                • Note that this also works for directories

                  – Paul Berg
                  Sep 30 '18 at 10:40














                • 1





                  This was driving me nuts. I was thinking why -f wouldn't work on non-GNU and how to make it work. This works. Thanks

                  – sdkks
                  Oct 13 '17 at 10:14











                • Note that this also works for directories

                  – Paul Berg
                  Sep 30 '18 at 10:40








                1




                1





                This was driving me nuts. I was thinking why -f wouldn't work on non-GNU and how to make it work. This works. Thanks

                – sdkks
                Oct 13 '17 at 10:14





                This was driving me nuts. I was thinking why -f wouldn't work on non-GNU and how to make it work. This works. Thanks

                – sdkks
                Oct 13 '17 at 10:14













                Note that this also works for directories

                – Paul Berg
                Sep 30 '18 at 10:40





                Note that this also works for directories

                – Paul Berg
                Sep 30 '18 at 10:40













                19














                There are many ways to do that; here is one example that may work for you:



                claw:~ jonv$ echo `pwd`/`ls config.in.php`
                /Users/jonv/config.in.php


                If you want more examples, there are a bunch on this post at stackoverflow.






                share|improve this answer





















                • 1





                  Most good answers on in stackoverflow.com/questions/5265702/… don't work out of the box on OS X, however.

                  – Quentin Pradet
                  Jun 9 '15 at 8:29


















                19














                There are many ways to do that; here is one example that may work for you:



                claw:~ jonv$ echo `pwd`/`ls config.in.php`
                /Users/jonv/config.in.php


                If you want more examples, there are a bunch on this post at stackoverflow.






                share|improve this answer





















                • 1





                  Most good answers on in stackoverflow.com/questions/5265702/… don't work out of the box on OS X, however.

                  – Quentin Pradet
                  Jun 9 '15 at 8:29
















                19












                19








                19







                There are many ways to do that; here is one example that may work for you:



                claw:~ jonv$ echo `pwd`/`ls config.in.php`
                /Users/jonv/config.in.php


                If you want more examples, there are a bunch on this post at stackoverflow.






                share|improve this answer















                There are many ways to do that; here is one example that may work for you:



                claw:~ jonv$ echo `pwd`/`ls config.in.php`
                /Users/jonv/config.in.php


                If you want more examples, there are a bunch on this post at stackoverflow.







                share|improve this answer














                share|improve this answer



                share|improve this answer








                edited May 23 '17 at 11:33









                Community

                1




                1










                answered Feb 15 '14 at 0:55









                yoonixyoonix

                573310




                573310








                • 1





                  Most good answers on in stackoverflow.com/questions/5265702/… don't work out of the box on OS X, however.

                  – Quentin Pradet
                  Jun 9 '15 at 8:29
















                • 1





                  Most good answers on in stackoverflow.com/questions/5265702/… don't work out of the box on OS X, however.

                  – Quentin Pradet
                  Jun 9 '15 at 8:29










                1




                1





                Most good answers on in stackoverflow.com/questions/5265702/… don't work out of the box on OS X, however.

                – Quentin Pradet
                Jun 9 '15 at 8:29







                Most good answers on in stackoverflow.com/questions/5265702/… don't work out of the box on OS X, however.

                – Quentin Pradet
                Jun 9 '15 at 8:29













                6














                In Mac OSX, do the following steps:





                1. cd into the directory of the target file.

                2. Type either of the following terminal commands.



                Terminal

                ls "`pwd`/file.txt"
                echo $(pwd)/file.txt



                1. Replace file.txt with your actual file name.

                2. Press Enter.






                share|improve this answer




























                  6














                  In Mac OSX, do the following steps:





                  1. cd into the directory of the target file.

                  2. Type either of the following terminal commands.



                  Terminal

                  ls "`pwd`/file.txt"
                  echo $(pwd)/file.txt



                  1. Replace file.txt with your actual file name.

                  2. Press Enter.






                  share|improve this answer


























                    6












                    6








                    6







                    In Mac OSX, do the following steps:





                    1. cd into the directory of the target file.

                    2. Type either of the following terminal commands.



                    Terminal

                    ls "`pwd`/file.txt"
                    echo $(pwd)/file.txt



                    1. Replace file.txt with your actual file name.

                    2. Press Enter.






                    share|improve this answer













                    In Mac OSX, do the following steps:





                    1. cd into the directory of the target file.

                    2. Type either of the following terminal commands.



                    Terminal

                    ls "`pwd`/file.txt"
                    echo $(pwd)/file.txt



                    1. Replace file.txt with your actual file name.

                    2. Press Enter.







                    share|improve this answer












                    share|improve this answer



                    share|improve this answer










                    answered Mar 24 '16 at 6:12









                    MowzerMowzer

                    4873917




                    4873917























                        2














                        You can also use the "find" command for listing all files with complete path:



                        find DirectoryName -type f


                        or just the following:



                        find . -type f





                        share|improve this answer
























                        • This does not return the absolute path (which seems to be what OP was looking for)

                          – Ad N
                          Nov 8 '18 at 14:56


















                        2














                        You can also use the "find" command for listing all files with complete path:



                        find DirectoryName -type f


                        or just the following:



                        find . -type f





                        share|improve this answer
























                        • This does not return the absolute path (which seems to be what OP was looking for)

                          – Ad N
                          Nov 8 '18 at 14:56
















                        2












                        2








                        2







                        You can also use the "find" command for listing all files with complete path:



                        find DirectoryName -type f


                        or just the following:



                        find . -type f





                        share|improve this answer













                        You can also use the "find" command for listing all files with complete path:



                        find DirectoryName -type f


                        or just the following:



                        find . -type f






                        share|improve this answer












                        share|improve this answer



                        share|improve this answer










                        answered Jan 22 '18 at 10:07









                        MireiaMireia

                        291




                        291













                        • This does not return the absolute path (which seems to be what OP was looking for)

                          – Ad N
                          Nov 8 '18 at 14:56





















                        • This does not return the absolute path (which seems to be what OP was looking for)

                          – Ad N
                          Nov 8 '18 at 14:56



















                        This does not return the absolute path (which seems to be what OP was looking for)

                        – Ad N
                        Nov 8 '18 at 14:56







                        This does not return the absolute path (which seems to be what OP was looking for)

                        – Ad N
                        Nov 8 '18 at 14:56













                        1














                        Didn't like any of the given solutions so I made up my own based off of https://stackoverflow.com/a/22684652/953327



                        Create alias which simply is a function call that combines pwd and ls $1. You can then add this to your .bash_profile if you choose.



                        alias lsf='function _lsf(){ echo "$(pwd)/$(ls $1)"; };_lsf'


                        Example of use:



                        lsf registry.lock
                        -> /tmp/registry.lock


                        I chose lsf for "list full" or "list file", makes sense to me but feel free to modify.






                        share|improve this answer




























                          1














                          Didn't like any of the given solutions so I made up my own based off of https://stackoverflow.com/a/22684652/953327



                          Create alias which simply is a function call that combines pwd and ls $1. You can then add this to your .bash_profile if you choose.



                          alias lsf='function _lsf(){ echo "$(pwd)/$(ls $1)"; };_lsf'


                          Example of use:



                          lsf registry.lock
                          -> /tmp/registry.lock


                          I chose lsf for "list full" or "list file", makes sense to me but feel free to modify.






                          share|improve this answer


























                            1












                            1








                            1







                            Didn't like any of the given solutions so I made up my own based off of https://stackoverflow.com/a/22684652/953327



                            Create alias which simply is a function call that combines pwd and ls $1. You can then add this to your .bash_profile if you choose.



                            alias lsf='function _lsf(){ echo "$(pwd)/$(ls $1)"; };_lsf'


                            Example of use:



                            lsf registry.lock
                            -> /tmp/registry.lock


                            I chose lsf for "list full" or "list file", makes sense to me but feel free to modify.






                            share|improve this answer













                            Didn't like any of the given solutions so I made up my own based off of https://stackoverflow.com/a/22684652/953327



                            Create alias which simply is a function call that combines pwd and ls $1. You can then add this to your .bash_profile if you choose.



                            alias lsf='function _lsf(){ echo "$(pwd)/$(ls $1)"; };_lsf'


                            Example of use:



                            lsf registry.lock
                            -> /tmp/registry.lock


                            I chose lsf for "list full" or "list file", makes sense to me but feel free to modify.







                            share|improve this answer












                            share|improve this answer



                            share|improve this answer










                            answered Jan 25 at 1:03









                            FGregFGreg

                            1508




                            1508























                                0














                                The following will find a file within the working directory that matches file.txt and return its absolute path



                                find `pwd` -name file.txt





                                share|improve this answer




























                                  0














                                  The following will find a file within the working directory that matches file.txt and return its absolute path



                                  find `pwd` -name file.txt





                                  share|improve this answer


























                                    0












                                    0








                                    0







                                    The following will find a file within the working directory that matches file.txt and return its absolute path



                                    find `pwd` -name file.txt





                                    share|improve this answer













                                    The following will find a file within the working directory that matches file.txt and return its absolute path



                                    find `pwd` -name file.txt






                                    share|improve this answer












                                    share|improve this answer



                                    share|improve this answer










                                    answered Feb 7 at 0:12









                                    markmark

                                    331313




                                    331313






























                                        draft saved

                                        draft discarded




















































                                        Thanks for contributing an answer to Super User!


                                        • 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%2fsuperuser.com%2fquestions%2f717105%2fhow-to-show-full-path-of-a-file-including-the-full-filename-in-mac-osx-terminal%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

                                        If I really need a card on my start hand, how many mulligans make sense? [duplicate]

                                        Alcedinidae

                                        Can an atomic nucleus contain both particles and antiparticles? [duplicate]