How to analyse disk usage in command line linux?












93















du and df are nice, but I don't know how to filter the data they provide the way I do with SequoiaView. I would like to know which are the largest folders and the largest files in a glance.










share|improve this question

























  • Have you trued ncdu?

    – SDsolar
    Sep 9 '17 at 7:44
















93















du and df are nice, but I don't know how to filter the data they provide the way I do with SequoiaView. I would like to know which are the largest folders and the largest files in a glance.










share|improve this question

























  • Have you trued ncdu?

    – SDsolar
    Sep 9 '17 at 7:44














93












93








93


37






du and df are nice, but I don't know how to filter the data they provide the way I do with SequoiaView. I would like to know which are the largest folders and the largest files in a glance.










share|improve this question
















du and df are nice, but I don't know how to filter the data they provide the way I do with SequoiaView. I would like to know which are the largest folders and the largest files in a glance.







linux disk-space du df






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited May 26 '16 at 9:49









galacticninja

3,8401363100




3,8401363100










asked Jun 22 '11 at 12:30









Jader DiasJader Dias

7,43147128182




7,43147128182













  • Have you trued ncdu?

    – SDsolar
    Sep 9 '17 at 7:44



















  • Have you trued ncdu?

    – SDsolar
    Sep 9 '17 at 7:44

















Have you trued ncdu?

– SDsolar
Sep 9 '17 at 7:44





Have you trued ncdu?

– SDsolar
Sep 9 '17 at 7:44










7 Answers
7






active

oldest

votes


















137





+50









You might also want to try the NCurses Disk Usage aka ncdu.



Use it like ncdu -x -q if you're invoking it remotely (e. g. via ssh) and ncdu -x otherwise.



ncdu 1.6 ~ Use the arrow keys to navigate, press ? for help
--- /home/geek -----------------------------------------------------------------
27.6MiB /qm test 1 rework
312.0kiB /sidebar
88.0kiB /rackerhacker-MySQLTuner-perl-6add618
8.0kiB /.w3m
4.0kiB /.cache
e 4.0kiB /.ssh
160.0kiB ng.tar.gz
76.0kiB plowshare_1~svn1673-1_all.deb
4.0kiB .bashrc
4.0kiB .bash_history
4.0kiB .profile
4.0kiB .htoprc
4.0kiB .bash_logout
0.0 B .lesshst


This is available under Mac OS X too.



The following flags to the command line might be helpful:



-q Quiet mode, doesn't update the screen 10 times a second
while scanning, reduces network bandwidth used

-x Don't cross filesystem borders (don't descend into a
directory which is a mounted disk)


Thanks to Sorin Sbarnea.






share|improve this answer





















  • 1





    Available under OS X too, via brew. It may be a good idea to call it using ncdu -x -q

    – sorin
    Dec 13 '12 at 12:46








  • 1





    awesome! the best option for me was ncdu -q, even in ssh.

    – Valter Silva
    Apr 19 '13 at 14:36



















45














Use some combination of the commands and options:



du --max-depth=1 2> /dev/null | sort -n -r | head -n20


to view only the largest few. If you'd like to use it a lot, then bind it to an alias, e.g. in bash by adding to ~/.bashrc



alias largest='du --max-depth=1 2> /dev/null | sort -n -r | head -n20'





share|improve this answer





















  • 1





    To view the largest few, you need the -r option on sort.

    – RedGrittyBrick
    Jun 22 '11 at 13:23











  • I submitted @RedGrittyBrick suggestion and an error redirection to /dev/null as an edit subject to approval.

    – Jader Dias
    Jun 22 '11 at 13:39











  • I would also use the du -H option, but it breaks the sort behavior

    – Jader Dias
    Jun 22 '11 at 13:54








  • 1





    @jumpnett: it redirects standard error (in this case into the black hole that is /dev/null).

    – Jaap Eldering
    Jun 6 '13 at 21:46








  • 3





    You can use sort -h to sort values with human readable suffixes.

    – allo
    Nov 30 '15 at 15:27



















4














You probably want xdu.



du -ax | xdu -n


There's also the more sophisticated KDE-based Filelight.






share|improve this answer

































    2














    I usually use



    du -hsc * | sort -h


    What each option means for du:




    • h: show sizes in human readable format (1K, 1M, 1G, ...)

    • s: summarize: display only a total for each argument

    • c: also display a grand total


    The -h option on sort makes it understand the -h format (human readable) on du. This option is relatively new on sort, so maybe your system does not support it and forces you to use du -sc | sort -n instead.



    If you do it on a remote machine and the process takes a long time, you probably want to execute this process backgrounded or inside a screen or something similar to prevent a connection loss.






    share|improve this answer































      2














      I would like to recommend dutree, which offers a hierachical visualization.



      You can select more or less levels of detail, and exclude paths for better control of visualization. You can also compare different paths.



      enter image description here



      It is implemented in Rust, fast and efficient.



      $ dutree -h
      Usage: dutree [options] <path> [<path>..]

      Options:
      -d, --depth [DEPTH] show directories up to depth N (def 1)
      -a, --aggr [N[KMG]] aggregate smaller than N B/KiB/MiB/GiB (def 1M)
      -s, --summary equivalent to -da, or -d1 -a1M
      -u, --usage report real disk usage instead of file size
      -b, --bytes print sizes in bytes
      -f, --files-only skip directories for a fast local overview
      -x, --exclude NAME exclude matching files or directories
      -H, --no-hidden exclude hidden files
      -A, --ascii ASCII characters only, no colors
      -h, --help show help
      -v, --version print version number





      share|improve this answer































        1














        du -h 2> /dev/null | sort -hr | head -n20


        du -h gives a human readable list estimate of disk space with a total
        2> /dev/null suppresses any errors such as read access denied
        sort -hr sorts the human readable file size in reverse order
        head -n20 reduce the list to 20



        Be aware that read access denied directories and files are excluded






        share|improve this answer































          0














          To know which are the largest folders and the largest files in a glance, you can also use the command line tool 'Top Disk Usage' (tdu):



          https://unix.stackexchange.com/questions/425615/how-to-get-top-immediate-sub-folders-of-folder-consuming-huge-disk-space-in/501089#501089






          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%2f300606%2fhow-to-analyse-disk-usage-in-command-line-linux%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            7 Answers
            7






            active

            oldest

            votes








            7 Answers
            7






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            137





            +50









            You might also want to try the NCurses Disk Usage aka ncdu.



            Use it like ncdu -x -q if you're invoking it remotely (e. g. via ssh) and ncdu -x otherwise.



            ncdu 1.6 ~ Use the arrow keys to navigate, press ? for help
            --- /home/geek -----------------------------------------------------------------
            27.6MiB /qm test 1 rework
            312.0kiB /sidebar
            88.0kiB /rackerhacker-MySQLTuner-perl-6add618
            8.0kiB /.w3m
            4.0kiB /.cache
            e 4.0kiB /.ssh
            160.0kiB ng.tar.gz
            76.0kiB plowshare_1~svn1673-1_all.deb
            4.0kiB .bashrc
            4.0kiB .bash_history
            4.0kiB .profile
            4.0kiB .htoprc
            4.0kiB .bash_logout
            0.0 B .lesshst


            This is available under Mac OS X too.



            The following flags to the command line might be helpful:



            -q Quiet mode, doesn't update the screen 10 times a second
            while scanning, reduces network bandwidth used

            -x Don't cross filesystem borders (don't descend into a
            directory which is a mounted disk)


            Thanks to Sorin Sbarnea.






            share|improve this answer





















            • 1





              Available under OS X too, via brew. It may be a good idea to call it using ncdu -x -q

              – sorin
              Dec 13 '12 at 12:46








            • 1





              awesome! the best option for me was ncdu -q, even in ssh.

              – Valter Silva
              Apr 19 '13 at 14:36
















            137





            +50









            You might also want to try the NCurses Disk Usage aka ncdu.



            Use it like ncdu -x -q if you're invoking it remotely (e. g. via ssh) and ncdu -x otherwise.



            ncdu 1.6 ~ Use the arrow keys to navigate, press ? for help
            --- /home/geek -----------------------------------------------------------------
            27.6MiB /qm test 1 rework
            312.0kiB /sidebar
            88.0kiB /rackerhacker-MySQLTuner-perl-6add618
            8.0kiB /.w3m
            4.0kiB /.cache
            e 4.0kiB /.ssh
            160.0kiB ng.tar.gz
            76.0kiB plowshare_1~svn1673-1_all.deb
            4.0kiB .bashrc
            4.0kiB .bash_history
            4.0kiB .profile
            4.0kiB .htoprc
            4.0kiB .bash_logout
            0.0 B .lesshst


            This is available under Mac OS X too.



            The following flags to the command line might be helpful:



            -q Quiet mode, doesn't update the screen 10 times a second
            while scanning, reduces network bandwidth used

            -x Don't cross filesystem borders (don't descend into a
            directory which is a mounted disk)


            Thanks to Sorin Sbarnea.






            share|improve this answer





















            • 1





              Available under OS X too, via brew. It may be a good idea to call it using ncdu -x -q

              – sorin
              Dec 13 '12 at 12:46








            • 1





              awesome! the best option for me was ncdu -q, even in ssh.

              – Valter Silva
              Apr 19 '13 at 14:36














            137





            +50







            137





            +50



            137




            +50





            You might also want to try the NCurses Disk Usage aka ncdu.



            Use it like ncdu -x -q if you're invoking it remotely (e. g. via ssh) and ncdu -x otherwise.



            ncdu 1.6 ~ Use the arrow keys to navigate, press ? for help
            --- /home/geek -----------------------------------------------------------------
            27.6MiB /qm test 1 rework
            312.0kiB /sidebar
            88.0kiB /rackerhacker-MySQLTuner-perl-6add618
            8.0kiB /.w3m
            4.0kiB /.cache
            e 4.0kiB /.ssh
            160.0kiB ng.tar.gz
            76.0kiB plowshare_1~svn1673-1_all.deb
            4.0kiB .bashrc
            4.0kiB .bash_history
            4.0kiB .profile
            4.0kiB .htoprc
            4.0kiB .bash_logout
            0.0 B .lesshst


            This is available under Mac OS X too.



            The following flags to the command line might be helpful:



            -q Quiet mode, doesn't update the screen 10 times a second
            while scanning, reduces network bandwidth used

            -x Don't cross filesystem borders (don't descend into a
            directory which is a mounted disk)


            Thanks to Sorin Sbarnea.






            share|improve this answer















            You might also want to try the NCurses Disk Usage aka ncdu.



            Use it like ncdu -x -q if you're invoking it remotely (e. g. via ssh) and ncdu -x otherwise.



            ncdu 1.6 ~ Use the arrow keys to navigate, press ? for help
            --- /home/geek -----------------------------------------------------------------
            27.6MiB /qm test 1 rework
            312.0kiB /sidebar
            88.0kiB /rackerhacker-MySQLTuner-perl-6add618
            8.0kiB /.w3m
            4.0kiB /.cache
            e 4.0kiB /.ssh
            160.0kiB ng.tar.gz
            76.0kiB plowshare_1~svn1673-1_all.deb
            4.0kiB .bashrc
            4.0kiB .bash_history
            4.0kiB .profile
            4.0kiB .htoprc
            4.0kiB .bash_logout
            0.0 B .lesshst


            This is available under Mac OS X too.



            The following flags to the command line might be helpful:



            -q Quiet mode, doesn't update the screen 10 times a second
            while scanning, reduces network bandwidth used

            -x Don't cross filesystem borders (don't descend into a
            directory which is a mounted disk)


            Thanks to Sorin Sbarnea.







            share|improve this answer














            share|improve this answer



            share|improve this answer








            edited Dec 14 '12 at 17:38

























            answered Oct 21 '12 at 14:45









            heinrich5991heinrich5991

            1,5381108




            1,5381108








            • 1





              Available under OS X too, via brew. It may be a good idea to call it using ncdu -x -q

              – sorin
              Dec 13 '12 at 12:46








            • 1





              awesome! the best option for me was ncdu -q, even in ssh.

              – Valter Silva
              Apr 19 '13 at 14:36














            • 1





              Available under OS X too, via brew. It may be a good idea to call it using ncdu -x -q

              – sorin
              Dec 13 '12 at 12:46








            • 1





              awesome! the best option for me was ncdu -q, even in ssh.

              – Valter Silva
              Apr 19 '13 at 14:36








            1




            1





            Available under OS X too, via brew. It may be a good idea to call it using ncdu -x -q

            – sorin
            Dec 13 '12 at 12:46







            Available under OS X too, via brew. It may be a good idea to call it using ncdu -x -q

            – sorin
            Dec 13 '12 at 12:46






            1




            1





            awesome! the best option for me was ncdu -q, even in ssh.

            – Valter Silva
            Apr 19 '13 at 14:36





            awesome! the best option for me was ncdu -q, even in ssh.

            – Valter Silva
            Apr 19 '13 at 14:36













            45














            Use some combination of the commands and options:



            du --max-depth=1 2> /dev/null | sort -n -r | head -n20


            to view only the largest few. If you'd like to use it a lot, then bind it to an alias, e.g. in bash by adding to ~/.bashrc



            alias largest='du --max-depth=1 2> /dev/null | sort -n -r | head -n20'





            share|improve this answer





















            • 1





              To view the largest few, you need the -r option on sort.

              – RedGrittyBrick
              Jun 22 '11 at 13:23











            • I submitted @RedGrittyBrick suggestion and an error redirection to /dev/null as an edit subject to approval.

              – Jader Dias
              Jun 22 '11 at 13:39











            • I would also use the du -H option, but it breaks the sort behavior

              – Jader Dias
              Jun 22 '11 at 13:54








            • 1





              @jumpnett: it redirects standard error (in this case into the black hole that is /dev/null).

              – Jaap Eldering
              Jun 6 '13 at 21:46








            • 3





              You can use sort -h to sort values with human readable suffixes.

              – allo
              Nov 30 '15 at 15:27
















            45














            Use some combination of the commands and options:



            du --max-depth=1 2> /dev/null | sort -n -r | head -n20


            to view only the largest few. If you'd like to use it a lot, then bind it to an alias, e.g. in bash by adding to ~/.bashrc



            alias largest='du --max-depth=1 2> /dev/null | sort -n -r | head -n20'





            share|improve this answer





















            • 1





              To view the largest few, you need the -r option on sort.

              – RedGrittyBrick
              Jun 22 '11 at 13:23











            • I submitted @RedGrittyBrick suggestion and an error redirection to /dev/null as an edit subject to approval.

              – Jader Dias
              Jun 22 '11 at 13:39











            • I would also use the du -H option, but it breaks the sort behavior

              – Jader Dias
              Jun 22 '11 at 13:54








            • 1





              @jumpnett: it redirects standard error (in this case into the black hole that is /dev/null).

              – Jaap Eldering
              Jun 6 '13 at 21:46








            • 3





              You can use sort -h to sort values with human readable suffixes.

              – allo
              Nov 30 '15 at 15:27














            45












            45








            45







            Use some combination of the commands and options:



            du --max-depth=1 2> /dev/null | sort -n -r | head -n20


            to view only the largest few. If you'd like to use it a lot, then bind it to an alias, e.g. in bash by adding to ~/.bashrc



            alias largest='du --max-depth=1 2> /dev/null | sort -n -r | head -n20'





            share|improve this answer















            Use some combination of the commands and options:



            du --max-depth=1 2> /dev/null | sort -n -r | head -n20


            to view only the largest few. If you'd like to use it a lot, then bind it to an alias, e.g. in bash by adding to ~/.bashrc



            alias largest='du --max-depth=1 2> /dev/null | sort -n -r | head -n20'






            share|improve this answer














            share|improve this answer



            share|improve this answer








            edited Jun 22 '11 at 14:18









            Jader Dias

            7,43147128182




            7,43147128182










            answered Jun 22 '11 at 13:11









            Jaap ElderingJaap Eldering

            6,87111425




            6,87111425








            • 1





              To view the largest few, you need the -r option on sort.

              – RedGrittyBrick
              Jun 22 '11 at 13:23











            • I submitted @RedGrittyBrick suggestion and an error redirection to /dev/null as an edit subject to approval.

              – Jader Dias
              Jun 22 '11 at 13:39











            • I would also use the du -H option, but it breaks the sort behavior

              – Jader Dias
              Jun 22 '11 at 13:54








            • 1





              @jumpnett: it redirects standard error (in this case into the black hole that is /dev/null).

              – Jaap Eldering
              Jun 6 '13 at 21:46








            • 3





              You can use sort -h to sort values with human readable suffixes.

              – allo
              Nov 30 '15 at 15:27














            • 1





              To view the largest few, you need the -r option on sort.

              – RedGrittyBrick
              Jun 22 '11 at 13:23











            • I submitted @RedGrittyBrick suggestion and an error redirection to /dev/null as an edit subject to approval.

              – Jader Dias
              Jun 22 '11 at 13:39











            • I would also use the du -H option, but it breaks the sort behavior

              – Jader Dias
              Jun 22 '11 at 13:54








            • 1





              @jumpnett: it redirects standard error (in this case into the black hole that is /dev/null).

              – Jaap Eldering
              Jun 6 '13 at 21:46








            • 3





              You can use sort -h to sort values with human readable suffixes.

              – allo
              Nov 30 '15 at 15:27








            1




            1





            To view the largest few, you need the -r option on sort.

            – RedGrittyBrick
            Jun 22 '11 at 13:23





            To view the largest few, you need the -r option on sort.

            – RedGrittyBrick
            Jun 22 '11 at 13:23













            I submitted @RedGrittyBrick suggestion and an error redirection to /dev/null as an edit subject to approval.

            – Jader Dias
            Jun 22 '11 at 13:39





            I submitted @RedGrittyBrick suggestion and an error redirection to /dev/null as an edit subject to approval.

            – Jader Dias
            Jun 22 '11 at 13:39













            I would also use the du -H option, but it breaks the sort behavior

            – Jader Dias
            Jun 22 '11 at 13:54







            I would also use the du -H option, but it breaks the sort behavior

            – Jader Dias
            Jun 22 '11 at 13:54






            1




            1





            @jumpnett: it redirects standard error (in this case into the black hole that is /dev/null).

            – Jaap Eldering
            Jun 6 '13 at 21:46







            @jumpnett: it redirects standard error (in this case into the black hole that is /dev/null).

            – Jaap Eldering
            Jun 6 '13 at 21:46






            3




            3





            You can use sort -h to sort values with human readable suffixes.

            – allo
            Nov 30 '15 at 15:27





            You can use sort -h to sort values with human readable suffixes.

            – allo
            Nov 30 '15 at 15:27











            4














            You probably want xdu.



            du -ax | xdu -n


            There's also the more sophisticated KDE-based Filelight.






            share|improve this answer






























              4














              You probably want xdu.



              du -ax | xdu -n


              There's also the more sophisticated KDE-based Filelight.






              share|improve this answer




























                4












                4








                4







                You probably want xdu.



                du -ax | xdu -n


                There's also the more sophisticated KDE-based Filelight.






                share|improve this answer















                You probably want xdu.



                du -ax | xdu -n


                There's also the more sophisticated KDE-based Filelight.







                share|improve this answer














                share|improve this answer



                share|improve this answer








                edited Mar 23 '14 at 17:56

























                answered Jun 22 '11 at 15:00









                TeddyTeddy

                4,98431415




                4,98431415























                    2














                    I usually use



                    du -hsc * | sort -h


                    What each option means for du:




                    • h: show sizes in human readable format (1K, 1M, 1G, ...)

                    • s: summarize: display only a total for each argument

                    • c: also display a grand total


                    The -h option on sort makes it understand the -h format (human readable) on du. This option is relatively new on sort, so maybe your system does not support it and forces you to use du -sc | sort -n instead.



                    If you do it on a remote machine and the process takes a long time, you probably want to execute this process backgrounded or inside a screen or something similar to prevent a connection loss.






                    share|improve this answer




























                      2














                      I usually use



                      du -hsc * | sort -h


                      What each option means for du:




                      • h: show sizes in human readable format (1K, 1M, 1G, ...)

                      • s: summarize: display only a total for each argument

                      • c: also display a grand total


                      The -h option on sort makes it understand the -h format (human readable) on du. This option is relatively new on sort, so maybe your system does not support it and forces you to use du -sc | sort -n instead.



                      If you do it on a remote machine and the process takes a long time, you probably want to execute this process backgrounded or inside a screen or something similar to prevent a connection loss.






                      share|improve this answer


























                        2












                        2








                        2







                        I usually use



                        du -hsc * | sort -h


                        What each option means for du:




                        • h: show sizes in human readable format (1K, 1M, 1G, ...)

                        • s: summarize: display only a total for each argument

                        • c: also display a grand total


                        The -h option on sort makes it understand the -h format (human readable) on du. This option is relatively new on sort, so maybe your system does not support it and forces you to use du -sc | sort -n instead.



                        If you do it on a remote machine and the process takes a long time, you probably want to execute this process backgrounded or inside a screen or something similar to prevent a connection loss.






                        share|improve this answer













                        I usually use



                        du -hsc * | sort -h


                        What each option means for du:




                        • h: show sizes in human readable format (1K, 1M, 1G, ...)

                        • s: summarize: display only a total for each argument

                        • c: also display a grand total


                        The -h option on sort makes it understand the -h format (human readable) on du. This option is relatively new on sort, so maybe your system does not support it and forces you to use du -sc | sort -n instead.



                        If you do it on a remote machine and the process takes a long time, you probably want to execute this process backgrounded or inside a screen or something similar to prevent a connection loss.







                        share|improve this answer












                        share|improve this answer



                        share|improve this answer










                        answered Nov 30 '15 at 18:21









                        emiemi

                        1413




                        1413























                            2














                            I would like to recommend dutree, which offers a hierachical visualization.



                            You can select more or less levels of detail, and exclude paths for better control of visualization. You can also compare different paths.



                            enter image description here



                            It is implemented in Rust, fast and efficient.



                            $ dutree -h
                            Usage: dutree [options] <path> [<path>..]

                            Options:
                            -d, --depth [DEPTH] show directories up to depth N (def 1)
                            -a, --aggr [N[KMG]] aggregate smaller than N B/KiB/MiB/GiB (def 1M)
                            -s, --summary equivalent to -da, or -d1 -a1M
                            -u, --usage report real disk usage instead of file size
                            -b, --bytes print sizes in bytes
                            -f, --files-only skip directories for a fast local overview
                            -x, --exclude NAME exclude matching files or directories
                            -H, --no-hidden exclude hidden files
                            -A, --ascii ASCII characters only, no colors
                            -h, --help show help
                            -v, --version print version number





                            share|improve this answer




























                              2














                              I would like to recommend dutree, which offers a hierachical visualization.



                              You can select more or less levels of detail, and exclude paths for better control of visualization. You can also compare different paths.



                              enter image description here



                              It is implemented in Rust, fast and efficient.



                              $ dutree -h
                              Usage: dutree [options] <path> [<path>..]

                              Options:
                              -d, --depth [DEPTH] show directories up to depth N (def 1)
                              -a, --aggr [N[KMG]] aggregate smaller than N B/KiB/MiB/GiB (def 1M)
                              -s, --summary equivalent to -da, or -d1 -a1M
                              -u, --usage report real disk usage instead of file size
                              -b, --bytes print sizes in bytes
                              -f, --files-only skip directories for a fast local overview
                              -x, --exclude NAME exclude matching files or directories
                              -H, --no-hidden exclude hidden files
                              -A, --ascii ASCII characters only, no colors
                              -h, --help show help
                              -v, --version print version number





                              share|improve this answer


























                                2












                                2








                                2







                                I would like to recommend dutree, which offers a hierachical visualization.



                                You can select more or less levels of detail, and exclude paths for better control of visualization. You can also compare different paths.



                                enter image description here



                                It is implemented in Rust, fast and efficient.



                                $ dutree -h
                                Usage: dutree [options] <path> [<path>..]

                                Options:
                                -d, --depth [DEPTH] show directories up to depth N (def 1)
                                -a, --aggr [N[KMG]] aggregate smaller than N B/KiB/MiB/GiB (def 1M)
                                -s, --summary equivalent to -da, or -d1 -a1M
                                -u, --usage report real disk usage instead of file size
                                -b, --bytes print sizes in bytes
                                -f, --files-only skip directories for a fast local overview
                                -x, --exclude NAME exclude matching files or directories
                                -H, --no-hidden exclude hidden files
                                -A, --ascii ASCII characters only, no colors
                                -h, --help show help
                                -v, --version print version number





                                share|improve this answer













                                I would like to recommend dutree, which offers a hierachical visualization.



                                You can select more or less levels of detail, and exclude paths for better control of visualization. You can also compare different paths.



                                enter image description here



                                It is implemented in Rust, fast and efficient.



                                $ dutree -h
                                Usage: dutree [options] <path> [<path>..]

                                Options:
                                -d, --depth [DEPTH] show directories up to depth N (def 1)
                                -a, --aggr [N[KMG]] aggregate smaller than N B/KiB/MiB/GiB (def 1M)
                                -s, --summary equivalent to -da, or -d1 -a1M
                                -u, --usage report real disk usage instead of file size
                                -b, --bytes print sizes in bytes
                                -f, --files-only skip directories for a fast local overview
                                -x, --exclude NAME exclude matching files or directories
                                -H, --no-hidden exclude hidden files
                                -A, --ascii ASCII characters only, no colors
                                -h, --help show help
                                -v, --version print version number






                                share|improve this answer












                                share|improve this answer



                                share|improve this answer










                                answered May 3 '18 at 9:33









                                nachoparkernachoparker

                                1212




                                1212























                                    1














                                    du -h 2> /dev/null | sort -hr | head -n20


                                    du -h gives a human readable list estimate of disk space with a total
                                    2> /dev/null suppresses any errors such as read access denied
                                    sort -hr sorts the human readable file size in reverse order
                                    head -n20 reduce the list to 20



                                    Be aware that read access denied directories and files are excluded






                                    share|improve this answer




























                                      1














                                      du -h 2> /dev/null | sort -hr | head -n20


                                      du -h gives a human readable list estimate of disk space with a total
                                      2> /dev/null suppresses any errors such as read access denied
                                      sort -hr sorts the human readable file size in reverse order
                                      head -n20 reduce the list to 20



                                      Be aware that read access denied directories and files are excluded






                                      share|improve this answer


























                                        1












                                        1








                                        1







                                        du -h 2> /dev/null | sort -hr | head -n20


                                        du -h gives a human readable list estimate of disk space with a total
                                        2> /dev/null suppresses any errors such as read access denied
                                        sort -hr sorts the human readable file size in reverse order
                                        head -n20 reduce the list to 20



                                        Be aware that read access denied directories and files are excluded






                                        share|improve this answer













                                        du -h 2> /dev/null | sort -hr | head -n20


                                        du -h gives a human readable list estimate of disk space with a total
                                        2> /dev/null suppresses any errors such as read access denied
                                        sort -hr sorts the human readable file size in reverse order
                                        head -n20 reduce the list to 20



                                        Be aware that read access denied directories and files are excluded







                                        share|improve this answer












                                        share|improve this answer



                                        share|improve this answer










                                        answered Mar 26 '17 at 23:59









                                        D-BD-B

                                        111




                                        111























                                            0














                                            To know which are the largest folders and the largest files in a glance, you can also use the command line tool 'Top Disk Usage' (tdu):



                                            https://unix.stackexchange.com/questions/425615/how-to-get-top-immediate-sub-folders-of-folder-consuming-huge-disk-space-in/501089#501089






                                            share|improve this answer




























                                              0














                                              To know which are the largest folders and the largest files in a glance, you can also use the command line tool 'Top Disk Usage' (tdu):



                                              https://unix.stackexchange.com/questions/425615/how-to-get-top-immediate-sub-folders-of-folder-consuming-huge-disk-space-in/501089#501089






                                              share|improve this answer


























                                                0












                                                0








                                                0







                                                To know which are the largest folders and the largest files in a glance, you can also use the command line tool 'Top Disk Usage' (tdu):



                                                https://unix.stackexchange.com/questions/425615/how-to-get-top-immediate-sub-folders-of-folder-consuming-huge-disk-space-in/501089#501089






                                                share|improve this answer













                                                To know which are the largest folders and the largest files in a glance, you can also use the command line tool 'Top Disk Usage' (tdu):



                                                https://unix.stackexchange.com/questions/425615/how-to-get-top-immediate-sub-folders-of-folder-consuming-huge-disk-space-in/501089#501089







                                                share|improve this answer












                                                share|improve this answer



                                                share|improve this answer










                                                answered Feb 17 at 12:09









                                                Joseph PaulJoseph Paul

                                                1011




                                                1011






























                                                    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%2f300606%2fhow-to-analyse-disk-usage-in-command-line-linux%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

                                                    flock() on closed filehandle LOCK_FILE at /usr/bin/apt-mirror

                                                    Mangá

                                                     ⁒  ․,‪⁊‑⁙ ⁖, ⁇‒※‌, †,⁖‗‌⁝    ‾‸⁘,‖⁔⁣,⁂‾
”‑,‥–,‬ ,⁀‹⁋‴⁑ ‒ ,‴⁋”‼ ⁨,‷⁔„ ‰′,‐‚ ‥‡‎“‷⁃⁨⁅⁣,⁔
⁇‘⁔⁡⁏⁌⁡‿‶‏⁨ ⁣⁕⁖⁨⁩⁥‽⁀  ‴‬⁜‟ ⁃‣‧⁕‮ …‍⁨‴ ⁩,⁚⁖‫ ,‵ ⁀,‮⁝‣‣ ⁑  ⁂– ․, ‾‽ ‏⁁“⁗‸ ‾… ‹‡⁌⁎‸‘ ‡⁏⁌‪ ‵⁛ ‎⁨ ―⁦⁤⁄⁕