리눅스 디렉토리 또는 파일 사이즈 보는 명령어 , du 명령어
- Operating System
- 2013. 7. 3.
리눅스 디렉토리 또는 파일 사이즈 보는 명령어 , du 명령어
리눅스에서 특정 폴더의 사이즈들을 보고 싶을 때 du 명령어를 사용하면 된다.
가령, 월별로 특정 디렉토리에 파일이 떨어질 때 해당 폴더들의 사이즈를 확인 할 때 유용하다.
|
다양한 옵션으로 활용이 가능하다.
du --help
로 해서 옵션들 보면서 적용해보면 된다.
현재 디렉토리 사이즈 확인
[root@ora10 ~]# du -sh
52M .
[root@ora10 ~]# du -sh .
52M .
[root@ora10 ~]#
현재 폴더들의 사이즈를 메가단위로 사이즈 작은 순서대로 정렬 할때
# du -Sh . | sort -n
96M ./20120829
96M ./20121218
97M ./20120810
97M ./20130502
98M ./20120418
99M ./20130329
100M ./20120727
100M ./20121019
100M ./20121115
100M ./20130204
100M ./20130507
현재 폴더들의 사이즈를 메가단위로 사이즈 큰 순서대로 정렬 할때
# du -Sh . | sort -n -r
|
[root@ora10 ~]# du --help
Usage: du [OPTION]... [FILE]...
or: du [OPTION]... --files0-from=F
Summarize disk usage of each FILE, recursively for directories.
Mandatory arguments to long options are mandatory for short options too.
-a, --all write counts for all files, not just directories
--apparent-size print apparent sizes, rather than disk usage; although
the apparent size is usually smaller, it may be
larger due to holes in (`sparse') files, internal
fragmentation, indirect blocks, and the like
-B, --block-size=SIZE use SIZE-byte blocks
-b, --bytes equivalent to `--apparent-size --block-size=1'
-c, --total produce a grand total
-D, --dereference-args dereference FILEs that are symbolic links
--files0-from=F summarize disk usage of the NUL-terminated file
names specified in file F
-H like --si, but also evokes a warning; will soon
change to be equivalent to --dereference-args (-D)
-h, --human-readable print sizes in human readable format (e.g., 1K 234M 2G)
--si like -h, but use powers of 1000 not 1024
-k like --block-size=1K
-l, --count-links count sizes many times if hard linked
-m like --block-size=1M
-L, --dereference dereference all symbolic links
-P, --no-dereference don't follow any symbolic links (this is the default)
-0, --null end each output line with 0 byte rather than newline
-S, --separate-dirs do not include size of subdirectories
-s, --summarize display only a total for each argument
-x, --one-file-system skip directories on different file systems
-X FILE, --exclude-from=FILE Exclude files that match any pattern in FILE.
--exclude=PATTERN Exclude files that match PATTERN.
--max-depth=N print the total for a directory (or file, with --all)
only if it is N or fewer levels below the command
line argument; --max-depth=0 is the same as
--summarize
--time show time of the last modification of any file in the
directory, or any of its subdirectories
--time=WORD show time as WORD instead of modification time:
atime, access, use, ctime or status
--time-style=STYLE show times using style STYLE:
full-iso, long-iso, iso, +FORMAT
FORMAT is interpreted like `date'
--help display this help and exit
--version output version information and exit
SIZE may be (or may be an integer optionally followed by) one of following:
kB 1000, K 1024, MB 1000*1000, M 1024*1024, and so on for G, T, P, E, Z, Y.
Report bugs to <bug-coreutils@gnu.org>.
[root@ora10 ~]# sort --help
Usage: sort [OPTION]... [FILE]...
Write sorted concatenation of all FILE(s) to standard output.
Mandatory arguments to long options are mandatory for short options too.
Ordering options:
-b, --ignore-leading-blanks ignore leading blanks
-d, --dictionary-order consider only blanks and alphanumeric characters
-f, --ignore-case fold lower case to upper case characters
-g, --general-numeric-sort compare according to general numerical value
-i, --ignore-nonprinting consider only printable characters
-M, --month-sort compare (unknown) < `JAN' < ... < `DEC'
-n, --numeric-sort compare according to string numerical value
-r, --reverse reverse the result of comparisons
Other options:
-c, --check check whether input is sorted; do not sort
-k, --key=POS1[,POS2] start a key at POS1, end it at POS2 (origin 1)
-m, --merge merge already sorted files; do not sort
-o, --output=FILE write result to FILE instead of standard output
-s, --stable stabilize sort by disabling last-resort comparison
-S, --buffer-size=SIZE use SIZE for main memory buffer
-t, --field-separator=SEP use SEP instead of non-blank to blank transition
-T, --temporary-directory=DIR use DIR for temporaries, not $TMPDIR or /tmp;
multiple options specify multiple directories
-u, --unique with -c, check for strict ordering;
without -c, output only the first of an equal run
-z, --zero-terminated end lines with 0 byte, not newline
--help display this help and exit
--version output version information and exit
POS is F[.C][OPTS], where F is the field number and C the character position
in the field. OPTS is one or more single-letter ordering options, which
override global ordering options for that key. If no key is given, use the
entire line as the key.
SIZE may be followed by the following multiplicative suffixes:
% 1% of memory, b 1, K 1024 (default), and so on for M, G, T, P, E, Z, Y.
With no FILE, or when FILE is -, read standard input.
*** WARNING ***
The locale specified by the environment affects sort order.
Set LC_ALL=C to get the traditional sort order that uses
native byte values.
Report bugs to <bug-coreutils@gnu.org>.
이 포스트를 추천해 주시면 더욱 많은 분들에게 보여집니다~!