IT

우분투에서 파일/디렉토리 크기순으로 출력하기

알 수 없는 사용자 2022. 1. 12. 17:22
반응형

우분투에서 파일정리를 할때 디렉토리를 크기순으로 정렬해서 보고 싶을때가 있다.

이때는 아래와 같이 입력하면 된다.

ubuntu@Name:~/anaconda3$ du -hs * | sort -h
4.0K    resources
8.0K    LICENSE.txt
8.0K    condabin
8.0K    ssl
12K     shell
12K     x86_64-conda_cos6-linux-gnu
16K     translations
16K     var
56K     man
96K     etc
100K    plugins
320K    phrasebooks
324K    qml
412K    sbin
568K    doc
648K    libexec
2.4M    compiler_compat
2.4M    share
3.2M    mkspecs
11M     conda-meta
76M     include
142M    envs
193M    bin
4.5G    lib
5.1G    pkgs

파일 디렉토리의 크기 순으로 정렬된 것을 볼 수 있다.

반응형

용량이 큰 디렉토리를 먼저 보고싶다면 sort 뒤에 r을 붙여주면 된다.

ubuntu@Name:~/anaconda3$ du -hs * | sort -hr
5.1G    pkgs
4.5G    lib
193M    bin
142M    envs
76M     include
11M     conda-meta
3.2M    mkspecs
2.4M    share
2.4M    compiler_compat
648K    libexec
568K    doc
412K    sbin
324K    qml
320K    phrasebooks
100K    plugins
96K     etc
56K     man
16K     var
16K     translations
12K     x86_64-conda_cos6-linux-gnu
12K     shell
8.0K    ssl
8.0K    condabin
8.0K    LICENSE.txt
4.0K    resources
반응형