터미널에서 디렉토리(폴더) 용량 확인 방법을 소개합니다.
1. du -sh
다음 명령어는 파일을 제외한 디렉토리의 크기만 출력합니다.
$ du -sh static
11M static
옵션에 대한 설명은 다음과 같습니다.
-s
: 파일을 제외한 디렉토리 크기만 출력-h
: 사람이 읽기 편한 용량 단위로 출력
-h
대신에 다음 명령어로 출력되는 단위를 변경할 수 있습니다.
-k
: KB로 출력-m
: MB로 출력
$ du -sm static
11 static
$ du -sk static
10492 static
du -h
파일과 디렉토리 용량이 모두 출력되고, 크기는 읽기 편한 단위로 출력
$ du -h static
2.1M static/posts/android-jetpack-paging
7.0M static/posts/android-adaptive-icon
516K static/posts/autosizing-textviews
9.6M static/posts
8.0K static/assets/js
152K static/assets/old-icon
152K static/assets/icon
420K static/assets/css
736K static/assets
11M static
du -s
파일을 제외한 디렉토리의 용량만 출력, 단위는 KB
$ du -s static
10492 static
2. du -h --max-depth=
--max-depth=1
는 디렉토리의 파일 용량을 모두 출력할 때, 하위 1개 depth에 해당하는 파일들만 출력하라는 명령어입니다.
아래와 같이 static 폴더의 하위 1개 디렉토리까지만 출력되었습니다.
$ du -h static --max-depth=1
9.6M static/posts
736K static/assets
11M static
--max-depth=<depth>
옵션으로 depth를 조절할 수 있습니다.
Loading script...
Related Posts
- Ubuntu에서 draw.io 설치하는 방법
- 리눅스 deb 파일 설치
- 우분투에 VMware 설치하기
- [Ubuntu] VMware에서 Windows 11 설치
- Vi/Vim에서 1줄 또는 여러줄 삭제 방법
- Vi/Vim에서 라인 번호 표시하기
- 우분투에서 rar 압축, 압축 풀기
- Ubuntu에서 구글 드라이브 사용하기 (로컬 폴더에 마운트)
- [Ubuntu] apt-cache search, 설치 가능한 패키지 검색
- Ubuntu - DNS 캐시 삭제 방법
- Ubuntu에서 사용할 수 있는 Text Editor 소개
- 우분투(리눅스) - RAM(메모리) 크기 확인
- 우분투에서 시간대(Timezone) 변경하기
- 우분투(리눅스)에서 Atom 텍스트 에디터 설치
- 우분투(리눅스)에서 Microsoft Edge 브라우저 설치
- 우분투(리눅스)에서 Slack 설치
- 우분투(리눅스)에서 Visual Studio Code 설치
- Linux - 파일, 디렉토리 삭제 명령어(rm -rf, rmdir)
- Linux - 파일이 수정된 날짜/시간 확인 방법
- Linux - touch로 파일 생성, 파일의 날짜/시간 변경
- Linux - Node.js로 Html 파일을 로컬 서버에서 실행하기
- Linux - zip, unzip으로 압축 및 압축 해제
- 우분투 - Linux 커널 삭제 방법
- Ubuntu에서 Right ALT를 한영키로 변환
- Linux 파일 권한 소개 및 권한 변경
- Linux - Image resize, Format 변경 명령어
- Ubuntu - Gradle 최신 버전 설치 방법
- Ubuntu - Notepad++ 설치 방법
- Ubuntu - Python 3.9 설치 방법
- Ubuntu - Sublime Text 4 설치 방법
- Ubuntu - nodejs LTS, 최신 버전 설치
- Proxy 환경에서 pip 사용 방법
- 최신 코드로 업데이트하는 repo sync 명령어
- Linux - 디렉토리 용량 확인
- Linux - IP 주소 확인