-1

From the book The Linux Command Line by William Shotts, page 33:

So now we have four instances of the file fun. Let's take a look at our playground directory.

[me@linuxbox playground]$ ls -1
total 16
drwxrwxr-x 2 me me 4096 2018-01-14 16:17 dir1
drwxrwxr-x 2 me me 4096 2018-01-14 16:17 dir2
-rw-r--r-- 4 me me 1650 2018-01-10 16:33 fun
-rw-r--r-- 4 me me 1650 2018-01-10 16:33 fun-hard

Total 16? I can’t see 16 files

Could you explain what this description means exactly:

drwxrwxr-x 2 me me 4096 2018-01-14 16:17 dir1

What does this letters means: drwxrwxr-x 2 me me 4096?

Why “me me”?

One thing we notice is that both the second fields in the listings for fun and fun-hard contain a 4, which is the number of hard links that now exist for the file.

Why he’s calling second fields?

Contain a 4?? I’m only seeing one file: -rw-r--r-- 4 me me 1650 2018-01-10 16:33 fun

BowPark
  • 4,895
  • Hello and welcome to Unix.SE! I can only answer to some of your questions. In drwxrwxr-x the beginning d means that this line refers to a directory: in fact, dir1 and dir2 are directories. The first me is the username of the author in his Linux system; the second me is his group. The "fields" are groups of characters, separated by spaces: -rw-r--r-- is the first field, 4 is the second field, me is the third field and so on. Please, search Google for the output of the ls command: try this. – BowPark Sep 19 '23 at 22:08
  • ls -1 won't have given you that output. I think you intended ls -l. Did you copy this from the book, or are you actually trying the examples on your own machine? You really need to be able to follow along and try stuff out yourself – Chris Davies Sep 19 '23 at 22:40

1 Answers1

0

To address one of your questions, total 16 on the first line of output for ls -l indicates that the files in that directory use 16 blocks of disk space, not that there are 16 files. A block is by default 1024 bytes, so 16384 bytes are allocated for the contents of the directory playground.

A verbose explanation of ls options and output can be found by executing info '(coreutils) ls invocation on the system where you are testing the things you are reading about. As noted in a comment on your question, with a book like this, it is important to experiment with the commands as they are introduced, and not just read the text.

user4556274
  • 8,995
  • 2
  • 33
  • 37
  • The given info command assumes a) info is installed, b) ls is from GNU coreutils - Unix-like systems use man as the command to access system manual/help. Neither assumption could be made based on the question. – Vilinkameni Sep 26 '23 at 19:17