Hitachi

JP1 Version 11 JP1/Advanced Shell Description, User's Guide, Reference, and Operator's Guide 


8.4.32 stat command (outputs the statuses of files and directories to the standard output)

Syntax

stat [-L] [-c format] [-t] path-name ...

Description

This command outputs file or directory statuses to the standard output. If a symbolic link file is specified for path-name, the command displays the status of the symbolic link file without using the link.

Arguments

-L

--dereference

Specifies that if a symbolic link file is specified for path-name, the command is to display the status of the file or directory at the link destination.

-c format

--format=format

Specifies the format in which the status of a file or directory is to be displayed . For format, you can specify a format specification code and any character string. For details about the display formats and format specification codes when this option is specified, see Unique display format in Display formats. If an unsupported format specification code is specified, the command outputs a warning message to the standard error output and a question mark (?) to the standard output, and then resumes the subsequent processing.

If this option is specified together with the -t option, this option takes effect.

-t

--terse

Specifies that the information is to be displayed in the concise format. For details about the concise display format, see Concise display format in Display formats.

path-name

Specifies the name of a file or a directory whose status is to be displayed.

If multiple path names are specified, file or directory statuses are displayed vertically. If the command is executed with multiple path names specified and the status display fails even for one of the files or directories, the command terminates with return code 1.

Return codes

Return code

Meaning

0

Normal termination

1 or greater

Error termination

Display formats

The three file information display formats are the normal display format, the concise display format, and the unique display format. The display format to be used depends on the options specification.

Normal display format

This is the display format used when no option is specified. The following file information is displayed with the indicated labels:

Output information

Label

Quoted file name

For a symbolic link, the reference target of the symbolic link is also displayed.

File:

Total size

Size:

Number of allocated blocks

Blocks:

Optimum block size for file system I/O operations

IO Block:

File type

For details about the information that is displayed, see Information displayed as file types in Display formats.

-

Device number

This information is displayed in the format device-number-in-hexadecimal-h/device-number-in-decimal-d.

Nothing is displayed for non-device files.

Device:

Inode number

Inode:

Number of hard links

Links:

Device file type

This information is displayed in the format major-device-number,minor-device-number. Nothing is displayed for non-device files.

Device type:

Permissions

This information is displayed in the format permissions-in-octal/permissions-character-string.

Access:

Owner's user information

This information is displayed in the format owner's-user-ID/owner's-user-name.

Uid:

Owner's group information

This information is displayed in the format owner's-group-ID/owner's-group-name.

Gid:

File's most recent access date and time

Access:

File's most recent modification date and time

Modify:

Most recent date and time file information was changed

Change:

Legend:

-: Displayed without a label.

Concise display format

This is the display format used when the -t option is specified. The following information is displayed sequentially separated by the space.

Unique display format

This is the display format used when the -c option is specified. You can specify a unique display format by combining format specification codes and any character strings. Also, format specification code % can be followed by a flag character, field width, and precision.

Information displayed as file types

The following table lists the file types that are displayed and their meanings:

File type

Meaning

regular file

Regular file

directory

Directory

symbolic link

Symbolic link

fifo

FIFO (UNIX only)

socket

Socket (UNIX only)

block special file

Block special file (UNIX only)

character special file

Character special file (UNIX only)

unknown file

Unknown file (other than the above) (UNIX only)

Notes

Examples