attr - Get or set attributes for files

Synopsis

attr [ -hp ] file [ attribute [ =value ] ... ]

Description

The attr utility gets or sets attributes for the object specified by file. When no attributes are specified, attr displays all of the attributes for the object in a re-entrable format to standard output. When an attribute is specified, attr displays the value of the attribute to standard output. When an attribute and value are specified, attr sets the attribute to the value. Note that all attributes can be displayed, but only some attributes can be set.

For date and time attributes, the value displayed by default is formatted with the asctime() function. If the LC_TIME environment variable is set, the value displayed is formatted with the format specified by the d_t_fmt keyword in the LC_TIME category of the specified locale.

See the Qp0lGetAttr() API for detailed information about the attributes and their values.

Options

-h
Display or set the attributes of a symbolic link instead of the object pointed to by the symbolic link.
-p
Display the attribute in an re-entrable format.

Operands

The file operand specifies a path name to an object. The attribute operand can have the following values:

ACCESS_TIME
The date and time the object was last accessed. This attribute can only be displayed.

ALLOC_SIZE
The number of bytes allocated for the object displayed as a 32-bit number. This attribute can only be displayed.

ALLOC_SIZE_64
The number of bytes allocated for the object displayed as a 64-bit number. This attribute can only be displayed.

ALWCKPWRT
An indicator if a stream file can be shared with readers and writers during the save-while-active checkpoint processing. This attribute can be displayed or set.

ALWSAV
An indicator of whether the object can be saved or not. This attribute can be displayed or set.

ASP
The auxillary storage pool in which the object is stored. This attribute can only be displayed.

AUDIT
The auditing value associated with the object. This attribute can only be displayed.

AUTH_GROUP
The name of the user profile that is the primary group for the object. This attribute can only be displayed.

AUTH_LIST_NAME
The name of the authorization list used to secure the object. This attribute can only be displayed.

AUTH_OWNER
The name of the user profile that is the owner of the object. This attribute can only be displayed.

AUTH_USERS
The list of user profiles that are authorized to use the object. This attribute can only be displayed.

CCSID
The coded character set identifier (CCSID) of the object. This attribute can be displayed or set.

CHANGE_TIME
The date and time the object's data or attributes were last changed. This attribute can only be displayed.

CHECKED_OUT
An indicator if the object is checked out. This attribute can only be displayed.

CHECKED_OUT_USER
The user profile that has the object checked out. This attribute can only be displayed.

CHECKED_OUT_TIME
The date and time that the object was checked out. This attribute can only be displayed.

CODEPAGE
The code page derived from the coded character set identifier (CCSID) of the object. This attribute can be displayed or set.

CREATE_TIME
The date and time the object was created. This attribute can only be displayed.

Start of changeCRTOBJAUD
The create object auditing value associated with a directory. The auditing value is given to any objects created in the directory. This attribute can be displayed or set.End of change

CRTOBJSCAN
An indicator of whether the objects created in a directory will be scanned when exit programs are registered with any of the integrated file system scan-related exit points. This attribute can be displayed or set.

DATA_SIZE
The size in bytes of the data in the object displayed as a 32-bit number. This attribute can only be displayed.

DATA_SIZE_64
The size in bytes of the data in the object displayed as a 64-bit number. This attribute can only be displayed.

DIR_FORMAT
An indicator of the format of a directory object. This attribute can only be displayed.

DISK_STG_OPT
An indicator of how auxiliary storage storage is allocated by the system for the object. This attribute can be displayed or set.

EXTENDED_ATTR_SIZE
The number of bytes used for extended attributes for the object. This attribute can only be displayed.

FILE_FORMAT
The format of the stream file. This attribute can only be displayed.

FILE_ID
The file identifier of the object if the object is stored in the "root" (/), the QOpenSys, or a user-defined file system. This attribute can only be displayed.

JOURNAL_APPLY_CHANGES
An indicator of whether the object was restored with partial transactions which requires an Apply Journaled Changes (APYJRNCHG) command to complete the transaction. This attribute can only be displayed.

JOURNAL_ID
The journal identifier that can be used on journal-related commands and APIs. This attribute can only be displayed.

JOURNAL_LIBRARY
If the object is journaled, the library containing the currently used journal. If the object is not journaled, the library containing the last used journal. This attribute can only be displayed.

JOURNAL_NAME
If the object is journaled, the name of the currently used journal. If the object is not journaled, the name of the last used journal. This attribute can only be displayed.

JOURNAL_OPTIONS
The current journaling options. This attribute can only be displayed.

JOURNAL_RCVR_ASP
The name of the ASP for the library that contains the journal receiver. This attribute can only be displayed.

JOURNAL_RCVR_LIBRARY
The name of the library that contains the journal receiver. This attribute can only be displayed.

JOURNAL_RCVR_NAME
The name of the oldest journal receiver needed to successfully Apply Journaled Changes (APYJRNCHG). This attribute can only be displayed.

JOURNAL_ROLLBACK_ENDED
An indicator of whether the object had rollback ended before completion of a request to roll back a transaction. This attribute can only be displayed.

JOURNAL_START_TIME
The date and time that journaling was last started for the object. This attribute can only be displayed.

JOURNAL_STATUS
An indicator if the object is currently journaled. This attribute can only be displayed.

LOCAL_REMOTE
An indicator if the object is on the local system or a remote system. This attribute can only be displayed.

MAIN_STG_OPT
An indicator of how main storage is allocated and used by the system for the object. This attribute can be displayed or set.

MODIFY_TIME
The date and time that the object's data was last modified. This attribute can only be displayed.

MULT_SIGS
An indicator if the object has more than one i5/OS(TM) digital signature. This attribute can only be displayed.

OBJTYPE
A text string describing the type of the object. This attribute can only be displayed.

PC_ARCHIVE
An indicator if the object has changed since the last time the file was examined. This attribute can be displayed or set.

PC_HIDDEN
An indicator if the object is hidden. This attribute can be displayed or set.

PC_READ_ONLY
An indicator if the object is read-only. This attribute can be displayed or set.

PC_SYSTEM
An indicator if the object is a system object. This attribute can be displayed or set.

RSTDRNMUNL
An indicator of whether renames and unlinks are restricted for objects within a directory. Objects can be linked into a directory that has this attribute set on, but cannot be renamed or unlinked from it unless the user has the appropriate authority. This attribute can be displayed or set.

SCAN
An indicator of whether the object will be scanned when exit programs are registered with any of the integrated file system scan-related exit points. This attribute can be displayed or set.

SCAN_BINARY
An indicator of whether the object has been scanned in binary mode when it was previously scanned. This attribute can only be displayed.

SCAN_CCSID1
If an object has been scanned in text mode, the first CCSID used when it was previously scanned. This attribute can only be displayed.

SCAN_CCSID2
If an object has been scanned in text mode, the second CCSID used when it was previously scanned. This attribute can only be displayed.

SCAN_SIGS_DIFF
An indicator of whether the scan signature for the object is different from the global scan signature. This attribute can only be displayed.

SCAN_STATUS
The scan status for the object. This attribute can only be displayed.

SGID
An indicator if the effective group ID is set at run time. This attribute can be displayed or set.

SIGNED
An indicator if the object has an i5/OS(TM) digital signature. This attribute can only be displayed.

STG_FREE
An indicator if the data is moved offline. This attribute can only be displayed.

SUID
An indicator if the effective user ID is set at run time. This attribute can be displayed or set.

SYSTEM_ARCHIVE
An indicator if the object has changed and needs to be saved. This attribute can be displayed or set.

Start of changeSYSTEM_USE
An indicator if the object has a special use by the system. This attribute is valid only for stream files. This attribute can only be displayed.End of change

SYS_SIGNED
An indicator of whether the i5/OS(TM) digital signature is from a source that is trusted by the system. This attribute can only be displayed.

UDFS_DEFAULT_FORMAT
The default file format of stream files created in the user-defined file system. This attribute can only be displayed.

USAGE_DAYS_USED
The number of days an object has been used. This attribute can only be displayed.

USAGE_LAST_USED_TIME
The date and time that the object was last used. This attribute can only be displayed.

USAGE_RESET_TIME
The date and time that the object's days used count was reset to zero. This attribute can only be displayed.

Environment Variables

attr is affected by the following environment variables:

LANG
Provides a default value for locale categories that are not specifically set with a variable starting with LC_.
LC_TIME
Defines the output format for date and time attributes.

Exit Status

Related information

Examples

  1. Display all of the attributes for a file.
    attr script.sh
    
  2. Display the OBJTYPE and PC_READ_ONLY attributes for a file.
    attr script.sh OBJTYPE PC_READ_ONLY
    
  3. Display the DATA_SIZE_64 attribute in a re-entrable format for a file.
    attr -p script.sh DATA_SIZE_64
    
  4. Set the PC_HIDDEN attribute for a file.
    attr script.sh PC_HIDDEN=1