ls -s했을시에 표시되는 용량에 대해서 설명 좀 부탁드릴께요.

bigblues의 이미지

리눅스 공부를 시작한지 3달됐습니다. 혼자 책보면서 공부하는데..
서버관리실무바이블3, 뇌를자극하는 페도라 이렇게 두권보고 있습니다.
리눅스는 공부하면 할 수록 컴퓨터 기초가 중요하다는것을 느끼내요. CCNA 공부 마치고 리눅스 시작을했는데
전공이 컴퓨터 쪽이 아니다보니 막히는것이 많습니다. 아무리 찾아봐도 제 지식에서는 어떤것을 검색해야할지 몰라서
여기에 질문드립니다

ls -l에서 표시되는 용량은 byte 단위이고

ls -sl에서 표기되는 용량은 Kbyte단위로 알고 있습니다.

[man page]

-s, --size
with -l, print size of each file, in blocks
[블록 단위로 파일의 용량을 출력한다고 하는데 블록이라는 것이 어떤 의미인지요?]

[linux complete command reference 레드햇 에서 나온 프리북인듯합니다. 2000년에 나온듯하고요.]

–s, --size
Print the size of each file in 1KB blocks to the left of the filename. If the environment
variable POSIXLY_CORRECT is set, 512-byte blocks are used instead.
[파일의 좌측에 1KB블록 단위로 파일의 크기를 표시한다고 하고 POSIX옵션을 사용하면 512byte 블록 단위라고 나옵니다.]

물론 네이버에서 블록 이렇게 검색해봤지만 파일에 관한 개념이 너무 없다보니 검색을 중지하고 여기로 왔습니다.

아래 제가 실습한것입니다.

#touch 1 2 3 4 5

#ls -l
total 0
-rw-r--r-- 1 root root 0 Jan 22 19:29 1
-rw-r--r-- 1 root root 0 Jan 22 19:30 2
-rw-r--r-- 1 root root 0 Jan 22 19:30 3
-rw-r--r-- 1 root root 0 Jan 22 19:30 4
-rw-r--r-- 1 root root 0 Jan 22 19:30 5

#vi 1 [1이라고 한개의 문자만 입력]

#ls -l
total 4
-rw-r--r-- 1 root root 2 Jan 22 20:34 1 [분명 2바이트인데 total 4라고 나옵니다]
-rw-r--r-- 1 root root 0 Jan 22 19:30 2
-rw-r--r-- 1 root root 0 Jan 22 19:30 3
-rw-r--r-- 1 root root 0 Jan 22 19:30 4
-rw-r--r-- 1 root root 0 Jan 22 19:30 5

# ls -s
total 4
4 1 0 2 0 3 0 4 0 5

# vi 2 [1이라고 한개의 문자만 입력]

# ls -sl
total 8
4 -rw-r--r-- 1 root root 2 Jan 22 20:34 1 [2바이트인데 맨 앞에 표시된것은 4블록이라고 나옵니다.]
4 -rw-r--r-- 1 root root 2 Jan 22 20:34 2
0 -rw-r--r-- 1 root root 0 Jan 22 19:30 3
0 -rw-r--r-- 1 root root 0 Jan 22 19:30 4
0 -rw-r--r-- 1 root root 0 Jan 22 19:30 5

여기서 -sl옵션으로 봤을때 표기 되는 용량에 대해서 궁금합니다.

사방 찾아봤지만 역부족이었습니다. 도와주세요 ㅠㅠ

bushi의 이미지

[bushi@rose ~]$ dd if=/dev/zero of=a bs=1 count=1
1+0 records in
1+0 records out
1 byte (1 B) copied, 4.375e-05 s, 22.9 kB/s
[bushi@rose ~]$
 
[bushi@rose ~]$ ls -ls a
4 -rw-rw-r-- 1 bushi bushi 1 2010-01-22 21:05 a
[bushi@rose ~]$ 
 
[bushi@rose ~]$ ls -ls --block-size=512 a
8 -rw-rw-r-- 1 bushi bushi 1 2010-01-22 21:05 a
[bushi@rose ~]$ 
 
[bushi@rose ~]$ stat a
  File: `a'
  Size: 1         	Blocks: 8          IO Block: 4096   일반 파일
Device: 802h/2050d	Inode: 265101      Links: 1
Access: (0664/-rw-rw-r--)  Uid: (  707/   bushi)   Gid: (  707/   bushi)
Access: 2010-01-22 02:46:13.130711639 +0900
Modify: 2010-01-22 21:05:42.489711807 +0900
Change: 2010-01-22 21:05:42.489711807 +0900
[bushi@rose ~]$

OTL

bigblues의 이미지

bushi님이 올려준 화면을 보고 따라 해보니 모르는 명령어가 있었내요.
한가지 힌트는 잡은듯하내요. 우선 파일시스템에 대해서 공부해야겠네요^^;;

댓글 달기

Filtered HTML

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.

BBCode

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param>
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.

Textile

  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • You can use Textile markup to format text.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>

Markdown

  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • Quick Tips:
    • Two or more spaces at a line's end = Line break
    • Double returns = Paragraph
    • *Single asterisks* or _single underscores_ = Emphasis
    • **Double** or __double__ = Strong
    • This is [a link](http://the.link.example.com "The optional title text")
    For complete details on the Markdown syntax, see the Markdown documentation and Markdown Extra documentation for tables, footnotes, and more.
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>

Plain text

  • HTML 태그를 사용할 수 없습니다.
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
  • 줄과 단락은 자동으로 분리됩니다.
댓글 첨부 파일
이 댓글에 이미지나 파일을 업로드 합니다.
파일 크기는 8 MB보다 작아야 합니다.
허용할 파일 형식: txt pdf doc xls gif jpg jpeg mp3 png rar zip.
CAPTCHA
이것은 자동으로 스팸을 올리는 것을 막기 위해서 제공됩니다.