Not, answering about what the second field is particularly as that is well covered in the other two answers by @sudodus and @steeldriver, but rather about its reported 0
blocks value and how it relates to the seventh field and its 29
value which is the file's size reported in bytes and particularly on how the file is reported to have a 29
bytes size and yet still the used blocks reported is 0
(noted in the comment by @sudodus)... as the normal behavior for a file is to use zero blocks on disk when it's empty and a minimum of one block when it contains data no matter how small the size of the data compared to the size of the block (see more explanation here):
## Get filesystem info:
$ stat -f .
File: "."
ID: ea0dd13726e1c7f1 Namelen: 255 Type: ext2/ext3
Block size: 4096 Fundamental block size: 4096
Blocks: Total: 239946508 Free: 140401510 Available: 128194458
Inodes: Total: 61022208 Free: 59882281
$
## Create an empty normal file an examine it with "find"'s action "-ls"
$ touch file1
$
$ find . -name "file1" -ls
20578311 0 -rw-rw-r-- 1 ubuntu ubuntu 0 Nov 30 11:22 ./file1
$
## Write some data into the file and examine it again
$ printf '%s' "1" >> file1
$
$ find . -name "file1" -ls
20578311 4 -rw-rw-r-- 1 ubuntu ubuntu 1 Nov 30 11:26 ./file1
... there might be some explanation to that as follows (these are some of and not all the possibilities):
Under Ubuntu's current default filesystem EXT4 and default 4K block size
The file might be a sparse file ... as (on filesystems that support it) the contents of those files are dynamically generated by the filesystem at runtime when the file is read:
## Get filesystem info:
$ stat -f .
File: "."
ID: ea0dd13726e1c7f1 Namelen: 255 Type: ext2/ext3
Block size: 4096 Fundamental block size: 4096
Blocks: Total: 239946508 Free: 140401510 Available: 128194458
Inodes: Total: 61022208 Free: 59882281
$
## Create a sparse file of "29" bytes size and examine:
$ truncate -s 29 file2
$
$ find . -name "file2" -ls
20578315 0 -rw-rw-r-- 1 ubuntu ubuntu 29 Nov 30 11:30 ./file2
$
## Increase the size of the sparse file and examine again:
$ truncate -s 1G file2
$
$ find . -name "file2" -ls
20578315 0 -rw-rw-r-- 1 ubuntu ubuntu 1073741824 Nov 30 11:32 ./file2
Under other filesystems
Allocating less than a full block size on disk might be allowed ... For example NTFS:
## NTFS filesystem:
$ stat -f .
File: "."
ID: 0 Namelen: 255 Type: fuseblk
Block size: 4096 Fundamental block size: 4096
Blocks: Total: 1048575 Free: 1043189 Available: 1043189
Inodes: Total: 4205524 Free: 4205505
$
$
$ touch file
$
$ find . -name "file" -ls
64 0 -rwxrwxrwx 1 root root 0 Nov 30 11:59 ./file
$
$ printf '%s' "1" >> file
$
$ find . -name "file" -ls
64 1 -rwxrwxrwx 1 root root 1 Nov 30 12:01 ./file
$
$ head -c 29 /dev/zero > file
$
$ find . -name "file" -ls
64 1 -rwxrwxrwx 1 root root 29 Nov 30 12:03 ./file
$
$ head -c 1k /dev/zero > file
$
$ find . -name "file" -ls
64 4 -rwxrwxrwx 1 root root 1024 Nov 30 12:03 ./file
... other filesystems than NTFS might allow even less than that i.e. less than the 1K required by find
's action -ls
to report as 1
.
man find
's syntax goes,-ls
is an action and not an option. – Raffa Nov 29 '23 at 14:16