How can I make ls only display files?How do I create a permanent Bash alias?listing files in a directory without listing subdirectories and their contents in that directoryPreserving multi-column output from ls when pagingHow to Search for Files Recursively into SubdirectoriesHow to list all files within subdirectories without the path?ls command is only showing files, and no folders (spaces? instead of them)Using the ls command on an Ubuntu 14.04.10 server to explore my filesWhat does `ls --directory` stand for?Anything like Scroll Lock key in the bash of Linux subsystem in windows 10ls command: Show time only (in iso-format)How to display number of items in sub-directories from command line

Can I leave my car sitting outside for about 5 years?

Can I ignore an open source license if I checkout a version that was released prior to the license being added

Are unitarily equivalent permutation matrices permutation similar?

Aligning the Arrows

How did the Druids learn the Greek language by the time of Caesar's campaign in Gaul?

Why doesn't knowledge of how magic works break magic in this world?

How to teach children Santa is not real, while respecting other kids beliefs?

Expectation of 500 coin flips after 500 realizations

Who created Avada Kedavra?

writing Vec compare in a more compact way

How to stretch this Venn diagram?

Would a level 18+ Champion Fighter recover HP outside of combat?

How do you get to this trap position?

Do any countries have a pensions system funded entirely by past contributions, rather than current taxes?

"Dog" can mean "something of an inferior quality". What animals do we use, if any, to describe the opposite?

When is it not okay to cheap out on bike parts?

How to translate “就这么着吧”?

I shift the source code, you shift the input!

Why is "runway behind you" useless?

What does it mean to play in a mode?

Fourier transform is an isomorphism...but we don’t get when each frequency appears?

Was a four year-old forced to sleep on the floor of Leeds General Infirmary?

Is Nessa or Vanessa a Catholic name?

Replying an email



How can I make ls only display files?


How do I create a permanent Bash alias?listing files in a directory without listing subdirectories and their contents in that directoryPreserving multi-column output from ls when pagingHow to Search for Files Recursively into SubdirectoriesHow to list all files within subdirectories without the path?ls command is only showing files, and no folders (spaces? instead of them)Using the ls command on an Ubuntu 14.04.10 server to explore my filesWhat does `ls --directory` stand for?Anything like Scroll Lock key in the bash of Linux subsystem in windows 10ls command: Show time only (in iso-format)How to display number of items in sub-directories from command line






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty
margin-bottom:0;









24


















I figure there has to be a way of making ls only display non-directories, but the man page doesn't make it obvious










share|improve this question

























  • Not sure about ls, but you can easily do it with the file command: file /directory/containing/the/files -maxdepth 1 -not -type d.

    – Henning Kockerbeck
    Aug 11 '16 at 22:03






  • 1





    Another way would be to filter the output of ls through grep, something like ls -1F /directory/containing/the/files | grep -vE /$. But be aware that parsing the output of ls can be tricky.

    – Henning Kockerbeck
    Aug 11 '16 at 22:08






  • 2





    askubuntu.com/questions/289321/…

    – Rinzwind
    Aug 11 '16 at 23:01

















24


















I figure there has to be a way of making ls only display non-directories, but the man page doesn't make it obvious










share|improve this question

























  • Not sure about ls, but you can easily do it with the file command: file /directory/containing/the/files -maxdepth 1 -not -type d.

    – Henning Kockerbeck
    Aug 11 '16 at 22:03






  • 1





    Another way would be to filter the output of ls through grep, something like ls -1F /directory/containing/the/files | grep -vE /$. But be aware that parsing the output of ls can be tricky.

    – Henning Kockerbeck
    Aug 11 '16 at 22:08






  • 2





    askubuntu.com/questions/289321/…

    – Rinzwind
    Aug 11 '16 at 23:01













24













24









24


6






I figure there has to be a way of making ls only display non-directories, but the man page doesn't make it obvious










share|improve this question














I figure there has to be a way of making ls only display non-directories, but the man page doesn't make it obvious







ls






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Aug 11 '16 at 21:54









thinksinbinarythinksinbinary

7492 gold badges9 silver badges19 bronze badges




7492 gold badges9 silver badges19 bronze badges















  • Not sure about ls, but you can easily do it with the file command: file /directory/containing/the/files -maxdepth 1 -not -type d.

    – Henning Kockerbeck
    Aug 11 '16 at 22:03






  • 1





    Another way would be to filter the output of ls through grep, something like ls -1F /directory/containing/the/files | grep -vE /$. But be aware that parsing the output of ls can be tricky.

    – Henning Kockerbeck
    Aug 11 '16 at 22:08






  • 2





    askubuntu.com/questions/289321/…

    – Rinzwind
    Aug 11 '16 at 23:01

















  • Not sure about ls, but you can easily do it with the file command: file /directory/containing/the/files -maxdepth 1 -not -type d.

    – Henning Kockerbeck
    Aug 11 '16 at 22:03






  • 1





    Another way would be to filter the output of ls through grep, something like ls -1F /directory/containing/the/files | grep -vE /$. But be aware that parsing the output of ls can be tricky.

    – Henning Kockerbeck
    Aug 11 '16 at 22:08






  • 2





    askubuntu.com/questions/289321/…

    – Rinzwind
    Aug 11 '16 at 23:01
















Not sure about ls, but you can easily do it with the file command: file /directory/containing/the/files -maxdepth 1 -not -type d.

– Henning Kockerbeck
Aug 11 '16 at 22:03





Not sure about ls, but you can easily do it with the file command: file /directory/containing/the/files -maxdepth 1 -not -type d.

– Henning Kockerbeck
Aug 11 '16 at 22:03




1




1





Another way would be to filter the output of ls through grep, something like ls -1F /directory/containing/the/files | grep -vE /$. But be aware that parsing the output of ls can be tricky.

– Henning Kockerbeck
Aug 11 '16 at 22:08





Another way would be to filter the output of ls through grep, something like ls -1F /directory/containing/the/files | grep -vE /$. But be aware that parsing the output of ls can be tricky.

– Henning Kockerbeck
Aug 11 '16 at 22:08




2




2





askubuntu.com/questions/289321/…

– Rinzwind
Aug 11 '16 at 23:01





askubuntu.com/questions/289321/…

– Rinzwind
Aug 11 '16 at 23:01










5 Answers
5






active

oldest

votes


















37



















ls -p | grep -v /


Using ls -p tells ls to append a slash to entries which are a directory, and using grep -v / tells grep to return only lines not containing a slash.






share|improve this answer

























  • I checked this one because it's my favorite answer (while i did upvote all of them), but now trying to find a way to put it in columns and reverse the order of output...

    – thinksinbinary
    Aug 12 '16 at 12:11












  • "You can use 1 switch for single column list" sorry, i did try to figure out what you meant by that, i would appreciate and example/explanation if you would, i only know what a switch is in regards to C programming

    – thinksinbinary
    Aug 19 '16 at 0:30











  • @sdkks You don't need the 1 switch when piping the output as it will default to single column in that situation. If that is what you were meaning.

    – thomasrutter
    Aug 21 '16 at 23:27











  • @thinksinbinary not sure how to make it multi column but you could search for or ask your own separate question and someone will know.

    – thomasrutter
    Aug 21 '16 at 23:28


















7



















You may try this:



find . -maxdepth 1 -not -type d



And map this to a special alias.



But if you're really keen on using the ls command, here:



ls -p | egrep -v /$






share|improve this answer
































    6



















    Alternatively:



    ls -lAh | grep -v '^d'


    This method lists in




    • -l Long list format


    • -A Displays almost all (show hidden files but don't show . and ..)


    • -h Human readable file sizes

    while grep




    • -v Don't show matching records


    • Regular expression filter ^d - Those start with letter d (for directory) i.e drwxrwxr-x <some file details> <foldername>

    If you don't want to type every time, you may make it into an alias for your bash/shell profile.






    share|improve this answer


































      2



















      I saw in your( @thinksinbinary ) comment on the answer by @thomasrutter , that you wanted to be able to print them in reverse order and in columns. You probably have already figured it out or moved on, but here it is:



      ls -pr | grep -v / | column



      • -p adds the forward slash ('/') to the directory names


      • -r reverses the order of output


      • -v lets grep do an inverse search to print everything except the directories (everything that doesn't have the '/' that -p put there)

      • "column puts it in columns" - Captain Obvious





      share|improve this answer




















      • 1





        i do think it's cool that on the ubuntu forum people still comment on and read your posts after a long time. I've been wanting to get back into linux in order to learn assembly and operating systems since doing so on windows is much more difficult. Thanks!

        – thinksinbinary
        Oct 30 at 22:22


















      0



















      ls -F | grep -v /


      Above command displays files, But it includes symlinks, pipes, etc. If you want to eliminate them too, you can use one of the flags mentioned below.



      ls -F appends symbols to filenames. These symbols show useful information about files.




      • @ means symbolic link (or that the file has extended attributes).


      • * means executable.


      • = means socket.


      • | means named pipe.


      • > means door.


      • / means directory.

      ls -F | grep -Ev '/|@|*|=|>||'


      Above command displays only files.






      share|improve this answer


























        Your Answer








        StackExchange.ready(function()
        var channelOptions =
        tags: "".split(" "),
        id: "89"
        ;
        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/4.0/"u003ecc by-sa 4.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%2faskubuntu.com%2fquestions%2f811210%2fhow-can-i-make-ls-only-display-files%23new-answer', 'question_page');

        );

        Post as a guest















        Required, but never shown


























        5 Answers
        5






        active

        oldest

        votes








        5 Answers
        5






        active

        oldest

        votes









        active

        oldest

        votes






        active

        oldest

        votes









        37



















        ls -p | grep -v /


        Using ls -p tells ls to append a slash to entries which are a directory, and using grep -v / tells grep to return only lines not containing a slash.






        share|improve this answer

























        • I checked this one because it's my favorite answer (while i did upvote all of them), but now trying to find a way to put it in columns and reverse the order of output...

          – thinksinbinary
          Aug 12 '16 at 12:11












        • "You can use 1 switch for single column list" sorry, i did try to figure out what you meant by that, i would appreciate and example/explanation if you would, i only know what a switch is in regards to C programming

          – thinksinbinary
          Aug 19 '16 at 0:30











        • @sdkks You don't need the 1 switch when piping the output as it will default to single column in that situation. If that is what you were meaning.

          – thomasrutter
          Aug 21 '16 at 23:27











        • @thinksinbinary not sure how to make it multi column but you could search for or ask your own separate question and someone will know.

          – thomasrutter
          Aug 21 '16 at 23:28















        37



















        ls -p | grep -v /


        Using ls -p tells ls to append a slash to entries which are a directory, and using grep -v / tells grep to return only lines not containing a slash.






        share|improve this answer

























        • I checked this one because it's my favorite answer (while i did upvote all of them), but now trying to find a way to put it in columns and reverse the order of output...

          – thinksinbinary
          Aug 12 '16 at 12:11












        • "You can use 1 switch for single column list" sorry, i did try to figure out what you meant by that, i would appreciate and example/explanation if you would, i only know what a switch is in regards to C programming

          – thinksinbinary
          Aug 19 '16 at 0:30











        • @sdkks You don't need the 1 switch when piping the output as it will default to single column in that situation. If that is what you were meaning.

          – thomasrutter
          Aug 21 '16 at 23:27











        • @thinksinbinary not sure how to make it multi column but you could search for or ask your own separate question and someone will know.

          – thomasrutter
          Aug 21 '16 at 23:28













        37















        37











        37









        ls -p | grep -v /


        Using ls -p tells ls to append a slash to entries which are a directory, and using grep -v / tells grep to return only lines not containing a slash.






        share|improve this answer














        ls -p | grep -v /


        Using ls -p tells ls to append a slash to entries which are a directory, and using grep -v / tells grep to return only lines not containing a slash.







        share|improve this answer













        share|improve this answer




        share|improve this answer










        answered Aug 11 '16 at 23:53









        thomasrutterthomasrutter

        29.2k4 gold badges72 silver badges92 bronze badges




        29.2k4 gold badges72 silver badges92 bronze badges















        • I checked this one because it's my favorite answer (while i did upvote all of them), but now trying to find a way to put it in columns and reverse the order of output...

          – thinksinbinary
          Aug 12 '16 at 12:11












        • "You can use 1 switch for single column list" sorry, i did try to figure out what you meant by that, i would appreciate and example/explanation if you would, i only know what a switch is in regards to C programming

          – thinksinbinary
          Aug 19 '16 at 0:30











        • @sdkks You don't need the 1 switch when piping the output as it will default to single column in that situation. If that is what you were meaning.

          – thomasrutter
          Aug 21 '16 at 23:27











        • @thinksinbinary not sure how to make it multi column but you could search for or ask your own separate question and someone will know.

          – thomasrutter
          Aug 21 '16 at 23:28

















        • I checked this one because it's my favorite answer (while i did upvote all of them), but now trying to find a way to put it in columns and reverse the order of output...

          – thinksinbinary
          Aug 12 '16 at 12:11












        • "You can use 1 switch for single column list" sorry, i did try to figure out what you meant by that, i would appreciate and example/explanation if you would, i only know what a switch is in regards to C programming

          – thinksinbinary
          Aug 19 '16 at 0:30











        • @sdkks You don't need the 1 switch when piping the output as it will default to single column in that situation. If that is what you were meaning.

          – thomasrutter
          Aug 21 '16 at 23:27











        • @thinksinbinary not sure how to make it multi column but you could search for or ask your own separate question and someone will know.

          – thomasrutter
          Aug 21 '16 at 23:28
















        I checked this one because it's my favorite answer (while i did upvote all of them), but now trying to find a way to put it in columns and reverse the order of output...

        – thinksinbinary
        Aug 12 '16 at 12:11






        I checked this one because it's my favorite answer (while i did upvote all of them), but now trying to find a way to put it in columns and reverse the order of output...

        – thinksinbinary
        Aug 12 '16 at 12:11














        "You can use 1 switch for single column list" sorry, i did try to figure out what you meant by that, i would appreciate and example/explanation if you would, i only know what a switch is in regards to C programming

        – thinksinbinary
        Aug 19 '16 at 0:30





        "You can use 1 switch for single column list" sorry, i did try to figure out what you meant by that, i would appreciate and example/explanation if you would, i only know what a switch is in regards to C programming

        – thinksinbinary
        Aug 19 '16 at 0:30













        @sdkks You don't need the 1 switch when piping the output as it will default to single column in that situation. If that is what you were meaning.

        – thomasrutter
        Aug 21 '16 at 23:27





        @sdkks You don't need the 1 switch when piping the output as it will default to single column in that situation. If that is what you were meaning.

        – thomasrutter
        Aug 21 '16 at 23:27













        @thinksinbinary not sure how to make it multi column but you could search for or ask your own separate question and someone will know.

        – thomasrutter
        Aug 21 '16 at 23:28





        @thinksinbinary not sure how to make it multi column but you could search for or ask your own separate question and someone will know.

        – thomasrutter
        Aug 21 '16 at 23:28













        7



















        You may try this:



        find . -maxdepth 1 -not -type d



        And map this to a special alias.



        But if you're really keen on using the ls command, here:



        ls -p | egrep -v /$






        share|improve this answer





























          7



















          You may try this:



          find . -maxdepth 1 -not -type d



          And map this to a special alias.



          But if you're really keen on using the ls command, here:



          ls -p | egrep -v /$






          share|improve this answer



























            7















            7











            7









            You may try this:



            find . -maxdepth 1 -not -type d



            And map this to a special alias.



            But if you're really keen on using the ls command, here:



            ls -p | egrep -v /$






            share|improve this answer














            You may try this:



            find . -maxdepth 1 -not -type d



            And map this to a special alias.



            But if you're really keen on using the ls command, here:



            ls -p | egrep -v /$







            share|improve this answer













            share|improve this answer




            share|improve this answer










            answered Aug 11 '16 at 23:07









            theabhinavdastheabhinavdas

            3381 silver badge6 bronze badges




            3381 silver badge6 bronze badges
























                6



















                Alternatively:



                ls -lAh | grep -v '^d'


                This method lists in




                • -l Long list format


                • -A Displays almost all (show hidden files but don't show . and ..)


                • -h Human readable file sizes

                while grep




                • -v Don't show matching records


                • Regular expression filter ^d - Those start with letter d (for directory) i.e drwxrwxr-x <some file details> <foldername>

                If you don't want to type every time, you may make it into an alias for your bash/shell profile.






                share|improve this answer































                  6



















                  Alternatively:



                  ls -lAh | grep -v '^d'


                  This method lists in




                  • -l Long list format


                  • -A Displays almost all (show hidden files but don't show . and ..)


                  • -h Human readable file sizes

                  while grep




                  • -v Don't show matching records


                  • Regular expression filter ^d - Those start with letter d (for directory) i.e drwxrwxr-x <some file details> <foldername>

                  If you don't want to type every time, you may make it into an alias for your bash/shell profile.






                  share|improve this answer





























                    6















                    6











                    6









                    Alternatively:



                    ls -lAh | grep -v '^d'


                    This method lists in




                    • -l Long list format


                    • -A Displays almost all (show hidden files but don't show . and ..)


                    • -h Human readable file sizes

                    while grep




                    • -v Don't show matching records


                    • Regular expression filter ^d - Those start with letter d (for directory) i.e drwxrwxr-x <some file details> <foldername>

                    If you don't want to type every time, you may make it into an alias for your bash/shell profile.






                    share|improve this answer
















                    Alternatively:



                    ls -lAh | grep -v '^d'


                    This method lists in




                    • -l Long list format


                    • -A Displays almost all (show hidden files but don't show . and ..)


                    • -h Human readable file sizes

                    while grep




                    • -v Don't show matching records


                    • Regular expression filter ^d - Those start with letter d (for directory) i.e drwxrwxr-x <some file details> <foldername>

                    If you don't want to type every time, you may make it into an alias for your bash/shell profile.







                    share|improve this answer















                    share|improve this answer




                    share|improve this answer








                    edited Apr 13 '17 at 12:23









                    Community

                    1




                    1










                    answered Aug 12 '16 at 2:38









                    sdkkssdkks

                    1,2131 gold badge9 silver badges9 bronze badges




                    1,2131 gold badge9 silver badges9 bronze badges
























                        2



















                        I saw in your( @thinksinbinary ) comment on the answer by @thomasrutter , that you wanted to be able to print them in reverse order and in columns. You probably have already figured it out or moved on, but here it is:



                        ls -pr | grep -v / | column



                        • -p adds the forward slash ('/') to the directory names


                        • -r reverses the order of output


                        • -v lets grep do an inverse search to print everything except the directories (everything that doesn't have the '/' that -p put there)

                        • "column puts it in columns" - Captain Obvious





                        share|improve this answer




















                        • 1





                          i do think it's cool that on the ubuntu forum people still comment on and read your posts after a long time. I've been wanting to get back into linux in order to learn assembly and operating systems since doing so on windows is much more difficult. Thanks!

                          – thinksinbinary
                          Oct 30 at 22:22















                        2



















                        I saw in your( @thinksinbinary ) comment on the answer by @thomasrutter , that you wanted to be able to print them in reverse order and in columns. You probably have already figured it out or moved on, but here it is:



                        ls -pr | grep -v / | column



                        • -p adds the forward slash ('/') to the directory names


                        • -r reverses the order of output


                        • -v lets grep do an inverse search to print everything except the directories (everything that doesn't have the '/' that -p put there)

                        • "column puts it in columns" - Captain Obvious





                        share|improve this answer




















                        • 1





                          i do think it's cool that on the ubuntu forum people still comment on and read your posts after a long time. I've been wanting to get back into linux in order to learn assembly and operating systems since doing so on windows is much more difficult. Thanks!

                          – thinksinbinary
                          Oct 30 at 22:22













                        2















                        2











                        2









                        I saw in your( @thinksinbinary ) comment on the answer by @thomasrutter , that you wanted to be able to print them in reverse order and in columns. You probably have already figured it out or moved on, but here it is:



                        ls -pr | grep -v / | column



                        • -p adds the forward slash ('/') to the directory names


                        • -r reverses the order of output


                        • -v lets grep do an inverse search to print everything except the directories (everything that doesn't have the '/' that -p put there)

                        • "column puts it in columns" - Captain Obvious





                        share|improve this answer














                        I saw in your( @thinksinbinary ) comment on the answer by @thomasrutter , that you wanted to be able to print them in reverse order and in columns. You probably have already figured it out or moved on, but here it is:



                        ls -pr | grep -v / | column



                        • -p adds the forward slash ('/') to the directory names


                        • -r reverses the order of output


                        • -v lets grep do an inverse search to print everything except the directories (everything that doesn't have the '/' that -p put there)

                        • "column puts it in columns" - Captain Obvious






                        share|improve this answer













                        share|improve this answer




                        share|improve this answer










                        answered Oct 29 at 15:14









                        Levi UzodikeLevi Uzodike

                        211 bronze badge




                        211 bronze badge










                        • 1





                          i do think it's cool that on the ubuntu forum people still comment on and read your posts after a long time. I've been wanting to get back into linux in order to learn assembly and operating systems since doing so on windows is much more difficult. Thanks!

                          – thinksinbinary
                          Oct 30 at 22:22












                        • 1





                          i do think it's cool that on the ubuntu forum people still comment on and read your posts after a long time. I've been wanting to get back into linux in order to learn assembly and operating systems since doing so on windows is much more difficult. Thanks!

                          – thinksinbinary
                          Oct 30 at 22:22







                        1




                        1





                        i do think it's cool that on the ubuntu forum people still comment on and read your posts after a long time. I've been wanting to get back into linux in order to learn assembly and operating systems since doing so on windows is much more difficult. Thanks!

                        – thinksinbinary
                        Oct 30 at 22:22





                        i do think it's cool that on the ubuntu forum people still comment on and read your posts after a long time. I've been wanting to get back into linux in order to learn assembly and operating systems since doing so on windows is much more difficult. Thanks!

                        – thinksinbinary
                        Oct 30 at 22:22











                        0



















                        ls -F | grep -v /


                        Above command displays files, But it includes symlinks, pipes, etc. If you want to eliminate them too, you can use one of the flags mentioned below.



                        ls -F appends symbols to filenames. These symbols show useful information about files.




                        • @ means symbolic link (or that the file has extended attributes).


                        • * means executable.


                        • = means socket.


                        • | means named pipe.


                        • > means door.


                        • / means directory.

                        ls -F | grep -Ev '/|@|*|=|>||'


                        Above command displays only files.






                        share|improve this answer





























                          0



















                          ls -F | grep -v /


                          Above command displays files, But it includes symlinks, pipes, etc. If you want to eliminate them too, you can use one of the flags mentioned below.



                          ls -F appends symbols to filenames. These symbols show useful information about files.




                          • @ means symbolic link (or that the file has extended attributes).


                          • * means executable.


                          • = means socket.


                          • | means named pipe.


                          • > means door.


                          • / means directory.

                          ls -F | grep -Ev '/|@|*|=|>||'


                          Above command displays only files.






                          share|improve this answer



























                            0















                            0











                            0









                            ls -F | grep -v /


                            Above command displays files, But it includes symlinks, pipes, etc. If you want to eliminate them too, you can use one of the flags mentioned below.



                            ls -F appends symbols to filenames. These symbols show useful information about files.




                            • @ means symbolic link (or that the file has extended attributes).


                            • * means executable.


                            • = means socket.


                            • | means named pipe.


                            • > means door.


                            • / means directory.

                            ls -F | grep -Ev '/|@|*|=|>||'


                            Above command displays only files.






                            share|improve this answer














                            ls -F | grep -v /


                            Above command displays files, But it includes symlinks, pipes, etc. If you want to eliminate them too, you can use one of the flags mentioned below.



                            ls -F appends symbols to filenames. These symbols show useful information about files.




                            • @ means symbolic link (or that the file has extended attributes).


                            • * means executable.


                            • = means socket.


                            • | means named pipe.


                            • > means door.


                            • / means directory.

                            ls -F | grep -Ev '/|@|*|=|>||'


                            Above command displays only files.







                            share|improve this answer













                            share|improve this answer




                            share|improve this answer










                            answered Sep 30 at 7:00









                            BarathVutukuriBarathVutukuri

                            1262 bronze badges




                            1262 bronze badges































                                draft saved

                                draft discarded















































                                Thanks for contributing an answer to Ask Ubuntu!


                                • 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%2faskubuntu.com%2fquestions%2f811210%2fhow-can-i-make-ls-only-display-files%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

                                Tamil (spriik) Luke uk diar | Nawigatjuun

                                Align equal signs while including text over equalitiesAMS align: left aligned text/math plus multicolumn alignmentMultiple alignmentsAligning equations in multiple placesNumbering and aligning an equation with multiple columnsHow to align one equation with another multline equationUsing \ in environments inside the begintabularxNumber equations and preserving alignment of equal signsHow can I align equations to the left and to the right?Double equation alignment problem within align enviromentAligned within align: Why are they right-aligned?

                                Training a classifier when some of the features are unknownWhy does Gradient Boosting regression predict negative values when there are no negative y-values in my training set?How to improve an existing (trained) classifier?What is effect when I set up some self defined predisctor variables?Why Matlab neural network classification returns decimal values on prediction dataset?Fitting and transforming text data in training, testing, and validation setsHow to quantify the performance of the classifier (multi-class SVM) using the test data?How do I control for some patients providing multiple samples in my training data?Training and Test setTraining a convolutional neural network for image denoising in MatlabShouldn't an autoencoder with #(neurons in hidden layer) = #(neurons in input layer) be “perfect”?