WebDev/AWS・Linux

리눅스 du커맨드, 현재 디렉토리 하위 항목(파일/디렉토리) 용량 표시

hexis9 2022. 5. 29. 01:26

du 커맨드 (Disk Usage)
현재 디렉토리 하위의 파일 / 디렉토리 용량 확인

# 현재 디렉토리 하위 파일/디렉토리 용량 표시 + 용량 내림차순(용량 큰 것부터) + 상위 10항목
du -sh ./*  | sort -rh | head -10

# 현재 디렉토리 하위 디렉토리 용량 표시 + 용량 내림차순(용량 큰 것부터)
du -sh ./*/ | sort -rh

# 특정 패턴의 파일명 대상으로, 각 파일 용량 합계 표시
du -ch ./localhost_access_log.2022-* | grep total



(영문) 맨 윗줄 커맨드, 커맨드 및 옵션에 대한 설명
https://explainshell.com/explain?cmd=du+-sh+.%2F*+%7C+sort+-rh+%7C+head+-10

explainshell.com - du -sh ./* | sort -rh | head -10

Pipelines A pipeline is a sequence of one or more commands separated by one of the control operators | or |&. The format for a pipeline is: [time [-p]] [ ! ] command [ [|⎪|&] command2 ... ] The standard output of command is connected via a pipe to the st

explainshell.com