- my($dev, $ino, $mode, $nlink, $uid, $gid, $rdev,
-
$size, $atime, $mtime, $ctime, $blksize, $blocks)
-
= stat($filename);
$dev and $ino
The device number and inode number of the file. Together they make up a “license
plate” for the file. Even if it has more than one name (hard link), the combination
of device and inode numbers should always be unique.
$mode
The set of permission bits for the file, and some other bits. If you’ve ever used the
Unix command ls -l to get a detailed (long) file listing, you’ll see that each line of
output starts with something like -rwxr-xr-x. The nine letters and hyphens of file
permissions† correspond to the nine least-significant bits of $mode, which would,
in this case, give the octal number 0755. The other bits, beyond the lowest nine,
indicate other details about the file. So, if you need to work with the mode, you’ll
generally want to use the bitwise operators covered later in this chapter.
$nlink
The number of (hard) links to the file or directory. This is the number of true names
that the item has. This number is always 2 or more for directories and (usually) 1
for files. You’ll see more about this when we talk about creating links to files in
$uid and $gid
The numeric user ID and group ID showing the file’s ownership.
$size
The size in bytes, as returned by the -s file test.
$atime, $mtime, and $ctime
The three timestamps, but here they’re represented in the system’s timestamp for-
mat: a 32-bit number telling how many seconds have passed since the Epoch, an
arbitrary starting point for measuring system time. On Unix systems and some
others, the Epoch is the beginning of 1970 at midnight Universal Time, but the
Epoch is different on some machines. There’s more information later in this chapter
on turning that timestamp number into something useful.
阅读(251) | 评论(0) | 转发(0) |