excluding sub dir in command

Multi tool use
Multi tool use

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
0
down vote

favorite












I need to provide a detailed list of files in a directory in descending order of the file size. only to include 10 files in my output. I can not include sub directories in my output. I am having the problem with the last part, "not including sub directories" here is what I have so far but im stuck on excluding sub directories. Also if you could look at the below command to advise if this is correct



de@Classbox:~/LI_1/etc$ ls -lh -S | sort -r |head -10



I know if i use grep -v d it will exclude directories but i need it to exclude sub directories.










share|improve this question









New contributor




Deirdre is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.



















  • Your ls command is not recursing subdirectories; if this is part of a class to learn ls and grep, perhaps they're looking for ls ... | grep -v ^d? You'll likely get different answers here, so it'd be best to clearly explain where you're coming from and what you're expecting.
    – Jeff Schaller
    Oct 4 at 13:30














up vote
0
down vote

favorite












I need to provide a detailed list of files in a directory in descending order of the file size. only to include 10 files in my output. I can not include sub directories in my output. I am having the problem with the last part, "not including sub directories" here is what I have so far but im stuck on excluding sub directories. Also if you could look at the below command to advise if this is correct



de@Classbox:~/LI_1/etc$ ls -lh -S | sort -r |head -10



I know if i use grep -v d it will exclude directories but i need it to exclude sub directories.










share|improve this question









New contributor




Deirdre is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.



















  • Your ls command is not recursing subdirectories; if this is part of a class to learn ls and grep, perhaps they're looking for ls ... | grep -v ^d? You'll likely get different answers here, so it'd be best to clearly explain where you're coming from and what you're expecting.
    – Jeff Schaller
    Oct 4 at 13:30












up vote
0
down vote

favorite









up vote
0
down vote

favorite











I need to provide a detailed list of files in a directory in descending order of the file size. only to include 10 files in my output. I can not include sub directories in my output. I am having the problem with the last part, "not including sub directories" here is what I have so far but im stuck on excluding sub directories. Also if you could look at the below command to advise if this is correct



de@Classbox:~/LI_1/etc$ ls -lh -S | sort -r |head -10



I know if i use grep -v d it will exclude directories but i need it to exclude sub directories.










share|improve this question









New contributor




Deirdre is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











I need to provide a detailed list of files in a directory in descending order of the file size. only to include 10 files in my output. I can not include sub directories in my output. I am having the problem with the last part, "not including sub directories" here is what I have so far but im stuck on excluding sub directories. Also if you could look at the below command to advise if this is correct



de@Classbox:~/LI_1/etc$ ls -lh -S | sort -r |head -10



I know if i use grep -v d it will exclude directories but i need it to exclude sub directories.







command






share|improve this question









New contributor




Deirdre is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











share|improve this question









New contributor




Deirdre is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









share|improve this question




share|improve this question








edited Oct 4 at 19:26









Rui F Ribeiro

37k1273117




37k1273117






New contributor




Deirdre is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









asked Oct 4 at 12:15









Deirdre

194




194




New contributor




Deirdre is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





New contributor





Deirdre is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.






Deirdre is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











  • Your ls command is not recursing subdirectories; if this is part of a class to learn ls and grep, perhaps they're looking for ls ... | grep -v ^d? You'll likely get different answers here, so it'd be best to clearly explain where you're coming from and what you're expecting.
    – Jeff Schaller
    Oct 4 at 13:30
















  • Your ls command is not recursing subdirectories; if this is part of a class to learn ls and grep, perhaps they're looking for ls ... | grep -v ^d? You'll likely get different answers here, so it'd be best to clearly explain where you're coming from and what you're expecting.
    – Jeff Schaller
    Oct 4 at 13:30















Your ls command is not recursing subdirectories; if this is part of a class to learn ls and grep, perhaps they're looking for ls ... | grep -v ^d? You'll likely get different answers here, so it'd be best to clearly explain where you're coming from and what you're expecting.
– Jeff Schaller
Oct 4 at 13:30




Your ls command is not recursing subdirectories; if this is part of a class to learn ls and grep, perhaps they're looking for ls ... | grep -v ^d? You'll likely get different answers here, so it'd be best to clearly explain where you're coming from and what you're expecting.
– Jeff Schaller
Oct 4 at 13:30










1 Answer
1






active

oldest

votes

















up vote
1
down vote



accepted










Don't expect meaningful results if you sort by "human readable" file sizes. Try



ls -l| sort -k1,1.1 -k5nr | head -n 10


If there are less than 10 regular files, you need additional measures.






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',
    convertImagesToLinks: false,
    noModals: false,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: null,
    bindNavPrevention: true,
    postfix: "",
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );






    Deirdre is a new contributor. Be nice, and check out our Code of Conduct.









     

    draft saved


    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f473219%2fexcluding-sub-dir-in-command%23new-answer', 'question_page');

    );

    Post as a guest






























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes








    up vote
    1
    down vote



    accepted










    Don't expect meaningful results if you sort by "human readable" file sizes. Try



    ls -l| sort -k1,1.1 -k5nr | head -n 10


    If there are less than 10 regular files, you need additional measures.






    share|improve this answer
























      up vote
      1
      down vote



      accepted










      Don't expect meaningful results if you sort by "human readable" file sizes. Try



      ls -l| sort -k1,1.1 -k5nr | head -n 10


      If there are less than 10 regular files, you need additional measures.






      share|improve this answer






















        up vote
        1
        down vote



        accepted







        up vote
        1
        down vote



        accepted






        Don't expect meaningful results if you sort by "human readable" file sizes. Try



        ls -l| sort -k1,1.1 -k5nr | head -n 10


        If there are less than 10 regular files, you need additional measures.






        share|improve this answer












        Don't expect meaningful results if you sort by "human readable" file sizes. Try



        ls -l| sort -k1,1.1 -k5nr | head -n 10


        If there are less than 10 regular files, you need additional measures.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Oct 4 at 12:21









        RudiC

        1,84219




        1,84219




















            Deirdre is a new contributor. Be nice, and check out our Code of Conduct.









             

            draft saved


            draft discarded


















            Deirdre is a new contributor. Be nice, and check out our Code of Conduct.












            Deirdre is a new contributor. Be nice, and check out our Code of Conduct.











            Deirdre is a new contributor. Be nice, and check out our Code of Conduct.













             


            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f473219%2fexcluding-sub-dir-in-command%23new-answer', 'question_page');

            );

            Post as a guest













































































            OGBua 3cu,dy,x j0UrPy1lN9w,NJL UC7 oCN byO,GgAGolcSaPA8e13xY9nX74EJtG lL2RG874oIpzJGwYqIBNIA564acV RyYq
            XB,o3JPCRd3z4 1hocAwl0v7TzXb,gPM9Q3HF tg ScA,Oq42s88SLt m9sPraW8f1QbH9eKo8n

            Popular posts from this blog

            How to check contact read email or not when send email to Individual?

            How many registers does an x86_64 CPU actually have?

            Displaying single band from multi-band raster using QGIS