2

the question is, how can control the ls -l total output ? first impression with example that give us total = 0

els3@els3PC:~/test$ touch file
els3@els3PC:~/test$ ls -l
total 0
-rw-r--r-- 1 els3 els3 0 Jul 20 12:05 file

As i mention this example give us this result total = 0 by creating empty file.

in other way I will try to create a non empty file2 contain '3ls3' .

els3@els3PC:~/test$ cat > file2
3ls3
^C
els3@els3PC:~/test$ cat file2
3ls3
els3@els3PC:~/test$ ls -l
total 4
-rw-r--r-- 1 els3 els3 5 Jul 20 12:11 file2

this second example give us total 4 by creating a non empty file. the hole Q is how can i get for e.g total 1 or total 2 etc.. by creating a new file.

Jeff Schaller
  • 67,283
  • 35
  • 116
  • 255
3ls3
  • 23

1 Answers1

3

From man ls:

In addition, for each directory whose contents are displayed, the total number of 
512-byte  blocks used by the files in the directory is displayed on a line by 
itself, immediately before the information for the files in the directory.

The minimum number of blocks allocated to a file depends on OS, file system type etc, so there is no direct way to influence the number shown.

nohillside
  • 3,251