Linux ETC

ls 명령어의 파일 사이즈 쉽게 확인하기

ls 의 스위치 옵션 -h (--human-readable) 를 이용하면 KB/MB/GB 단위로 쉽게 파일 사이즈 확인이 가능하다.

[HOSTWAY] /home > # ls -alh
total 312G
drwxr-xr-x.  6 root      root      4.0K Oct 22 23:16 .
drwxrwxrwt  25 root      root      4.0K Oct 22 09:36 ..
-rw-r--r--   1 root      root       98G Oct 23 13:07 100GB_LUN01
-rw-r--r--   1 root      root      200G Oct 23 13:07 200GB_LUN01
drwx------.  2 root      root       16K Oct 13  2011 lost+found
drwxr-xr-x   3 root      root      4.0K Feb 28  2012 svn
-rw-r--r--   1 root      root      9.8G Nov 11  2011 SWAP_FILE

또한, -S 스위치 옵션을 사용하면, 사이즈로 descending 정렬이 가능하다.

[HOSTWAY] /home > # ls -alSh
total 312G
-rw-r--r--   1 root      root      200G Oct 23 13:07 200GB_LUN01
-rw-r--r--   1 root      root       98G Oct 23 13:07 100GB_LUN01
-rw-r--r--   1 root      root      9.8G Nov 11  2011 SWAP_FILE
drwx------.  2 root      root       16K Oct 13  2011 lost+found
drwxr-xr-x.  6 root      root      4.0K Oct 22 23:16 .
drwxrwxrwt  25 root      root      4.0K Oct 22 09:36 ..
drwxr-xr-x   3 root      root      4.0K Feb 28  2012 svn