lsattr 명령어 (AIX 5.3·6.1)
https://archive.horanglab.com/posts/aix-cmd-lsattr
핵심 정리
- 장치의 속성 이름, 값, 설명, 사용자가 바꿀 수 있는지(True/False)를 보여 줍니다.
lsattr -El 장치(현재 값),-D(기본값),-R -a 속성(허용 값·범위),-P(마지막으로 구성할 때의 값, 6.1).- 자주 쓰는 형태:
lsattr -El sys0(maxuproc, realmem 등 시스템 속성),lsattr -El hdisk0(queue_depth, reserve_policy),lsattr -El en0(IP, 넷마스크),lsattr -El fcs0. - 값은 장치가 아니라 ODM에서 읽습니다.
chdev -P로 ODM만 바꿨으면 재부팅 전까지 실제 동작 값과 다를 수 있습니다. -O는 속성 이름 줄과 값 줄을 콜론으로 나눠 보여 주어 스크립트에서 쓰기 좋습니다.
| 항목 | 내용 |
|---|---|
| 버전 | AIX 5.3, AIX 6.1 (6.1에서 -P(마지막으로 구성할 때의 값)와 -P·-O 조합이 더해짐) |
| 원문 | IBM Commands Reference — 5.3 Volume 3, 6.1 Volume 3 |
| 파일 | /usr/sbin/lsattr |
| 관련 명령어 | chdev, lsdev, lsconn, lscfg, odmget |
목적
시스템 장치의 속성 특성과 속성에 쓸 수 있는 값을 보여 줍니다.
영어 원문
Displays attribute characteristics and possible values of attributes for devices in the system.
구문
lsattr { -D [ -O ] | -E [ -O ] | -P [ -O ] | -F Format [ -Z Character ] } -l Name [ -a Attribute ] ...
[ -f File ] [ -h ] [ -H ]
lsattr { -D [ -O ] | -F Format [ -Z Character ] } { [ -c Class ] [ -s Subclass ] [ -t Type ] }
[ -a Attribute ] ... [ -f File ] [ -h ] [ -H ]
lsattr -R { -l Name | [ -c Class ] [ -s Subclass ] [ -t Type ] } -a Attribute [ -f File ] [ -h ] [ -H ]
lsattr -l Name { -o operation [ ... ] } -F Format [ -Z Character ] [ -f File ] [ -h ] [ -H ]
lsattr { [ -c Class ] [ -s Subclass ] [ -t Type ] } { -o operation [ ... ] } -F Format [ -Z Character ]
[ -f File ] [ -h ] [ -H ]
-P는 6.1 구문에만 있습니다.
설명
lsattr 명령은 특정 장치나 장치 유형의 속성 정보를 보여 줍니다. -l Name으로 장치 논리 이름을 주지 않으면 -c Class, -s Subclass, -t Type을 하나 이상 조합해 사전 정의 장치를 하나로 정해야 합니다.
다음 플래그 가운데 하나를 꼭 줘야 합니다.
| 플래그 | 보여 주는 것 |
|---|---|
-D |
기본값 |
-E |
현재 값(-l로 지정한 사용자 정의 장치에만) |
-F Format |
사용자가 정한 형식 |
-P |
장치를 마지막으로 구성했을 때의 값(6.1) |
-R |
쓸 수 있는 값의 범위 |
사용자 정의 장치의 현재 값을 볼 때 정보는 장치가 아니라 구성 데이터베이스에서 가져옵니다. 데이터베이스 값은 chdev의 -P나 -T로 다시 구성하지 않는 한 장치가 구성된 방식을 그대로 나타냅니다. 다시 구성했다면 다음 부팅 전까지 lsattr이 보여 주는 값이 실제 장치 구성과 다를 수 있습니다.
-D나 -E를 쓰면 -O를 함께 주지 않는 한 속성 이름, 값, 설명, 사용자 설정 가능 여부를 보여 줍니다.
(6.1) -P는 장치를 마지막으로 구성했을 때, 곧 chdev -P나 -T로 속성을 바꾸기 전의 값을 보여 줍니다.
-O는 지정한 속성 이름을 콜론으로 나눠 한 줄에, 그 값들을 콜론으로 나눠 다음 줄에 보여 줍니다. -H는 -D, -E, -F와 함께 열 이름 위에 머리글을 보여 줍니다. -F Format으로 출력 형식을 정할 수 있으며, Format은 영숫자가 아닌 문자나 공백으로 나눈 열 이름 목록을 따옴표로 감싼 것입니다. -F를 주면 -Z Character로 레코드 구분자를 줄바꿈 대신 그 문자로 바꿀 수 있습니다.
lsattr은 확장 사전 정의 속성(PdAtXtd) 객체 클래스의 "operation" 정보도 보여 줄 수 있습니다. Web-based System Manager가 쓰는 정보로, -o operation으로 봅니다. -o와 -a는 함께 쓸 수 없고 -o는 -R과도 함께 쓸 수 없으며, -o를 주면 -F에는 PdAtXtd 객체 클래스의 필드만 쓸 수 있습니다.
플래그는 명령줄에서 주거나 -f File로 파일에서 읽을 수 있습니다.
영어 원문
The lsattr command displays information about the attributes of a specific device or type of device. If you do not specify the device logical name with the -l Name flag, you must use a combination of one or all of the -c Class, -s Subclass, and -t Type flags to uniquely identify the predefined device. Association Class Role 1 Associator 1 Role 2 Associator 2 Node cimv2.IBMAIX_RunningOS Antecedent IBMAIX_OperatingSystem Dependent IBMAIX_ComputerSystem c175nf14 cimv2.IBMAIX_OSProcess GroupComponent IBMAIX_OperatingSystem PartComponent IBMAIX_UnixProcess c175nf14 cimv2.IBMAIX_CSProcessor GroupComponent IBMAIX_ComputerSystem PartComponent IBMAIX_Processor c175nf14 cimv2.IBMAIX_HostedFileSystem GroupComponent IBMAIX_ComputerSystem PartComponent CIM_FileSystem c175nf14
Association Class Role 1 Associator 1 Role 2 Associator 2 Node cimv2.Linux_RunningOS Antecedent Linux_OperatingSystem Dependent Linux_ComputerSystem c175nf14 cimv2.Linux_OSProcess GroupComponent Linux_OperatingSystem PartComponent Linux_UnixProcess c175nf14 cimv2.Linux_CSProcessor GroupComponent Linux_ComputerSystem PartComponent Linux_Processor c175nf14 cimv2.Linux_HostedFileSystem GroupComponent Linux_ComputerSystem PartComponent CIM_FileSystem c175nf14
You must specify one of the following flags with the lsattr command:
-D— Displays default values.-E— Displays effective values (valid only for customized devices that are specified with the-lflag).-FFormat — Specifies the user-defined format.-P— Displays device values when the device was last configured.-R— Displays the range of legal values.
When you display the effective values of the attributes for a customized device, the information is obtained from the Configuration database, not the device. The database values reflect how the device is configured unless it is reconfigured with the chdev command by using the -P or -T flag. If the reconfiguration occurs, the information that is displayed by the lsattr command might not correctly indicate the current device configuration until after the next system boot.
If you use the -D or -E flag, the output defaults to the values for the attribute's name, value, description, and user-settable strings, unless it is also used with the -O flag.
The -P flag displays the attribute values when the device was last configured, or before modifying any of its attributes by using the chdev command with the -P or -T flag.
The -O flag displays the names of all the attributes that are specified, separated by colons. On the next line, the -O flag displays all of the corresponding attribute values, separated by colons. The -H flag can be used with either the -D, -E, or -F flag to display headers above the column names. You can define the format of the output with a user-specified format by using the -F Format flag, where the Format parameter is a quoted list of column names, separated by non-alphanumeric characters or white space. If the -F Format flag is specified, the -Z Character flag can also be specified to change the default record separator from a newline character to the indicated Character.
The lsattr command can display "operation" information from the Extended Predefined Attribute (PdAtXtd) object class. This information is used by the web-based System Manager. The operation information is accessed through the -o operation flag. The -o operation flag and the -a attribute flag cannot be specified in the same invocation of the lsattr command. The -o operation flag is also not valid with the -R flag. When the -o operation flag is specified, only fields from the PdAtXtd object class can be specified with the -F Format flag.
You can supply the flags either on the command line or by using the specified -f File flag.
플래그
| 플래그 | 설명 |
|---|---|
-a Attribute |
지정한 속성의 정보를 보여 줍니다. 속성마다 -a를 하나씩 주거나, -a 하나에 여러 이름을 따옴표로 감싸 공백으로 나눠 줍니다. -R과 함께면 -a 하나에 속성 하나만 줍니다. -a도 -R도 없으면 모든 속성의 정보를 보여 줍니다. -o와 함께 쓰면 오류로 끝납니다. |
-c Class |
장치 클래스 이름. -E나 -l과 함께 쓸 수 없습니다. |
-D |
-O 없이 쓰면 속성 이름, 기본값, 설명, 사용자 설정 가능 여부를, -O와 함께면 이름과 기본값만 콜론 형식으로 보여 줍니다. -c, -s, -t 조합이나 -l과 함께 쓰며, -E, -F, -R과 함께 쓸 수 없습니다. |
-E |
-O 없이 쓰면 속성 이름, 현재 값, 설명, 사용자 설정 가능 여부를, -O와 함께면 이름과 현재 값만 콜론 형식으로 보여 줍니다. -c, -D, -F, -R, -s, -t와 함께 쓸 수 없습니다. |
-f File |
필요한 플래그를 File에서 읽습니다. |
-F Format |
사용자가 정한 형식으로 출력합니다. 구분자가 공백이면 열을 맞춥니다. PdAt, CuAt, PdAtXtd 객체 클래스의 열 이름과, 특수 이름 description(속성 설명), user_settable(바꿀 수 있는지)을 쓸 수 있습니다. -E, -D, -O, -R과 함께 쓸 수 없습니다. |
-H |
열 위에 머리글을 보여 줍니다. -O와 -R이 -H보다 우선합니다. |
-h |
사용법을 보여 줍니다. |
-l Name |
속성을 볼 장치의 논리 이름(사용자 정의 장치). |
-o Operation |
지정한 operation의 정보를 보여 줍니다. 여러 이름은 따옴표로 감싸 공백으로 나누고, odmget과 같은 와일드카드를 쓸 수 있습니다. "?*"는 모든 operation입니다. -a나 -R과 함께 쓰면 오류로 끝납니다. |
-O |
모든 속성 이름을 콜론으로 나눠 한 줄에, 값을 다음 줄에 보여 줍니다. -E면 현재 값, -D면 기본값입니다. -F, -R과 함께 쓸 수 없습니다. |
-P |
-O 없이 쓰면 속성 이름, 값, 설명, 사용자 설정 가능 여부를 보여 주며, 값은 chdev -P·-T로 바꾸기 전 장치를 구성할 때의 값입니다. -O와 함께면 이름과 값만 콜론 형식으로 보여 줍니다. -D, -E, -O, -R과 함께 쓸 수 없다고 적혀 있습니다. 6.1부터 |
-R |
속성에 쓸 수 있는 값을 보여 줍니다. 목록 값은 한 줄에 하나씩, 범위 값은 x...n(+i)(시작 x, 끝 n, 증가 i)로 보여 줍니다. -D, -E, -F, -O와 함께 쓸 수 없습니다. |
-s Subclass |
장치 하위 클래스 이름. -E나 -l과 함께 쓸 수 없습니다. |
-t Type |
장치 유형 이름. -E나 -l과 함께 쓸 수 없습니다. |
-Z Character |
줄바꿈이 들어 있을 수 있는 ODM 필드를 다루는 프로그램(Web-based System Manager 등)용으로, 출력 레코드 구분자를 Character로 바꿉니다. -F와 함께일 때만 의미가 있고 -D, -E, -O, -R과 함께 쓸 수 없습니다. |
영어 원문
-aAttribute — Displays information for the specified attributes of a specific device or type of device. You can use one-aflag for each attribute name or multiple attribute names. If you use one-aflag for multiple attribute names, the list of attribute names must be enclosed in quotation marks with spaces between the names. If you use the-Rflag, you must specify only one-aflag with only one attribute name. If you do not specify either the-aor-Rflag, the lsattr command displays all information for all attributes of the specified device. The-aAttribute flag cannot be used with the-oOperation flag. This combination of flags causes the lsattr command to exit with an error message.-cClass — Specifies a device class name. This flag can be used to restrict the output to devices of a specified class. This flag cannot be used with the-Eor-lflag.-D— Displays the attribute names, default values, descriptions, and user-settable flag values for a specific device when it is not used with the-Oflag. The-Dflag displays only the attribute name and default value in colon format when it is used with the-Oflag. This flag can be used with any combination of the-c,-s, and-tflags that uniquely identifies a device from the Predefined Devices object class, or with the-lflag. This flag cannot be used with the-E,-F, or-Rflag.-E— Displays the attribute names, current values, descriptions, and user-settable flag values for a specific device when it is not used with the-Oflag. The-Eflag displays only the attribute name and current value in colon format when it is used with the-Oflag. This flag cannot be used with the-c,-D,-F,-R,-s, or-tflag.-fFile — Reads the necessary flags from the File parameter.-FFormat — Displays the output in a user-specified format, where the Format parameter is a quoted list of column names separated by nonalphanumeric characters or white space. If white space is used as the separator, the lsattr command displays the output in aligned columns. Only column names from the Predefined Attributes (PdAt), Customized Attributes (CuAt), and the Extended Predefined Attributes (PdAtXtd) object classes can be specified. In addition to the column names, there are two special purpose names that can be used: the name description can be used to obtain a display of attribute descriptions anduser_settablecan be used to determine whether an attribute can be changed. This flag cannot be used with the-E,-D,-O, or-Rflag.-H— Displays headers above the column output. The-Oand-Rflags take precedence over the-Hflag.-h— Displays the command usage message.-lName — Specifies the device logical name in the Customized Devices object class whose attribute names or values you want displayed.-oOperation — Displays information for the specified operations of a specific device or type of device. You can use one-oflag for each operation name or multiple operation names. If you use one-oflag for multiple operation names, the list of operation names must be enclosed in quotation marks with spaces between the names. Wildcard characters can also be used for the operation name. The valid set of wildcard characters is the same set that is used by the odmget command. All operations that are associated with a specific device, or type of device, can be displayed by using an operation value of"?*". The-oOperation flag cannot be used with the-aattribute flag or the-Rflag. Any combination of these flags causes the lsattr command to exit with an error message.-O— Displays all attribute names separated by colons and on the second line, displays all the corresponding attribute values separated by colons. The attribute values are current values when the-Eflag is specified and default values when the-Dflag is specified. This flag cannot be used with the-Fand-Rflags.-P— Displays the attribute names, values, descriptions, and user-settable flag values for a specific device when it is not used with the-Oflag. The values that are displayed are those values with which the device was configured, before any of the device attributes were modified by using the chdev command with the-Por-Tflag. When the-Pflag is used with the-Oflag, the-Pflag displays only the attribute name and value in colon-separated format. This flag can be used with any combination of the-c,-s, and-tflags that uniquely identifies a device from the Predefined Devices object class, or with the-lflag. This flag cannot be used with the-D,-E,-O, or-Rflag.-R— Displays the legal values for an attribute name. The-Rflag cannot be used with the-D,-E,-Fand-Oflags, but can be used with any combination of the-c,-s, and-tflags that uniquely identifies a device from the Predefined Devices object class, or with the-lflag. The-Rflag displays the list attribute values in a vertical column as follows:Value1 Value2 . . ValueNThe-Rflag displays the range attribute values asx...n(+i)wherexis the start of the range,nis the end of the range, andiis the increment.-sSubclass — Specifies a device subclass name. This flag can be used to restrict the output to that for devices of a specified subclass. This flag cannot be used with the-Eor-lflag.-tType — Specifies a device type name. This flag can be used to restrict the output to that for devices of a specified class. This flag cannot be used with the-Eor-lflag.-ZCharacter — The-ZCharacter flag is used with programs that must deal with ODM fields that might have embedded new line characters. An example of such a program is the Web-based System Manager. The-ZCharacter flag is used to change the record separator character for each record, or line, of output generated. The new record separator is specified by using the Character argument to this flag. The-ZCharacter flag is only relevant when the-FFormat flag is specified. The-ZCharacter flag cannot be used with the-D,-E,-O, or-Rflag.
보안
RBAC 사용자와 Trusted AIX 사용자는 주의하세요. 이 명령은 특권 작업을 할 수 있으며, 특권 작업은 특권 사용자만 할 수 있습니다. 특권과 권한 목록은 lssecattr 명령이나 getcmdattr 하위 명령으로 봅니다(6.1 문서에만 있음).
영어 원문
Attention RBAC users and Trusted AIX users: This command can perform privileged operations. Only privileged users can run privileged operations. For more information about authorizations and privileges, see Privileged Command Database in Security. For a list of privileges and the authorizations associated with this command, see the lssecattr command or the getcmdattr subcommand.
예제
- 테이프 장치
rmt0의 현재 속성 값을 봅니다(기본값은-D로 보며 출력 형식이 같습니다).
lsattr -l rmt0 -E
mode yes Use DEVICE BUFFERS during writes True
block_size 1024 BLOCK size (0=variable length) True
extfm yes Use EXTENDED file marks True
compress yes Use data COMPRESSION True
size_in_mb 12000 Size in Megabytes False
- 그 밖의 예:
| 명령 | 하는 일 | 출력 예 |
|---|---|---|
lsattr -l rmt0 -D |
rmt0의 기본값 |
예 1과 같은 형식 |
lsattr -l scsi0 -a bus_intr_lvl -E |
SCSI 어댑터 scsi0의 bus_intr_lvl 현재 값 |
bus_intr_lvl 1 Bus interrupt level False |
lsattr -l tty0 -a login -R |
tty0의 login 속성에 쓸 수 있는 값 |
enable, disable, share, delay(한 줄에 하나) |
lsattr -c printer -s parallel -t ibm4340 -D |
IBM 4340 병렬 프린터의 기본값 | ptop 600 Printer TIME OUT period True 등 |
lsattr -c printer -s parallel -t ibm4340 -a ptop -R |
그 프린터의 ptop 속성 범위 |
1...1000 (+1) |
lsattr -l rmt0 -E -O |
rmt0의 현재 값을 콜론 형식으로 |
#mode:block_size:... 다음 줄에 yes:1024:... |
lsattr -E -l sys0 |
시스템 속성 | maxuproc 128 Maximum number of PROCESSES allowed per user True 등 |
참고: 시스템 속성은 SMIT의 System Environments → Change / Show Characteristics of Operating System에서 더 읽기 쉽게 볼 수 있습니다.
자주 쓰는 형태:
lsattr -El sys0 -a maxuproc -a realmem # 사용자당 프로세스 한도, 메모리(KB)
lsattr -El hdisk0 -a queue_depth -a reserve_policy
lsattr -Rl hdisk0 -a queue_depth # 쓸 수 있는 범위
lsattr -El en0 # netaddr, netmask, state
lsattr -El inet0 -a hostname -a route
lsattr -Pl hdisk0 -a queue_depth # (6.1) 마지막 구성 때의 값(chdev -P 전)
영어 원문
- To list the current attribute values for the
rmt0tape device, enter the following command:
lsattr -l rmt0 -E
The system displays a message similar to the following output:
mode yes Use DEVICE BUFFERS during writes True
block_size 1024 BLOCK size (0=variable length) True
extfm yes Use EXTENDED file marks True
ret no RETENSION on tape change or reset True
density_set_1 37 DENSITY setting #1 True
density_set_2 36 DENSITY setting #2 True
compress yes Use data COMPRESSION True
size_in_mb 12000 Size in Megabytes False
ret_error no RETURN error on tape change or reset True
- To list the default attribute values for the
rmt0tape device, enter the following command:
lsattr -l rmt0 -D
The system displays a message similar to the following output:
mode yes Use DEVICE BUFFERS during writes True
block_size 1024 BLOCK size (0=variable length) True
extfm yes Use EXTENDED file marks True
ret no RETENSION on tape change or reset True
density_set_1 37 DENSITY setting #1 True
density_set_2 36 DENSITY setting #2 True
compress yes Use data COMPRESSION True
size_in_mb 12000 Size in Megabytes False
ret_error no RETURN error on tape change or reset True
- To list the current value of the
bus_intr_lvlattribute for thescsi0SCSI adapter, enter the following command:
lsattr -l scsi0 -a bus_intr_lvl -E
The system displays a message similar to the following output:
bus_intr_lvl 1 Bus interrupt level False
- To list the possible values of the login attribute for the
tty0tty device, enter the following command:
lsattr -l tty0 -a login -R
The system displays a message similar to the following output:
enable
disable
share
delay
- To list the default attribute values for an IBM 4340 parallel printer, enter the following command:
lsattr -c printer -s parallel -t ibm4340 -D
The system displays a message similar to the following output:
ptop 600 Printer TIME OUT period True
line 60 Number of LINES per page True
col 80 Number of COLUMNS per page True
ind 0 Number of columns to INDENT True
plot no Send all characters to printer UNMODIFIED True
backspace yes Send BACKSPACES True
cr yes Send CARRIAGE RETURNS True
form yes Send FORM FEEDS True
lf yes Send LINE FEEDS True
addcr yes Add CARRIAGE RETURNS to LINE FEEDS True
case no Convert lowercase to UPPERCASE True
tabs yes EXPAND TABS on eight position boundaries True
wrap no WRAP CHARACTERS beyond the specified width True
mode no Return on ERROR True interface standard Type of PARALLEL INTERFACE True autoconfig available STATE to be configured at boot time True busy_delay 0 Microseconds to delay between characters True
- To list the possible values of the ptop attribute for an IBM 4340 parallel printer, enter the following command:
lsattr -c printer -s parallel -t ibm4340 -a ptop -R
The system displays a message similar to the following output: 1...1000 (+1)
- To list the current attribute values for the
rmt0tape device in colon-separated format, enter the following command:lsattr -l rmt0 -E -O
The system displays a message similar to the following output: #mode:block_size:extfm:ret:density_set_1:density_set_2:compress:size_in_mb:ret_error yes:1024:yes:no:37:36:yes:12000:no
- To display system attributes, enter the following command:
lsattr -E -l sys0
The system displays output similar to the following output: keylock normal State of system keylock at boot time False maxbuf 20 Maximum number of pages in block I/O BUFFER CACHE True maxmbuf 0 Maximum Kbytes of real memory allowed for MBUFS True maxuproc 128 Maximum number of PROCESSES allowed per user True autorestart false Automatically REBOOT system after a crash True iostat false Continuously maintain DISK I/O history True realmem 4194304 Amount of usable physical memory in Kbytes False conslogin enable System Console Login False fwversion IBM,SPH00221 Firmware version and revision levels False maxpout 0 HIGH water mark for pending write I/Os per file True minpout 0 LOW water mark for pending write I/Os per file True fullcore false Enable full CORE dump True pre430core false Use pre-430 style CORE dump True ncargs 256 ARG/ENV list size in 4K byte blocks True rtasversion 1 Open Firmware RTAS version False modelname IBM,7044-270 Machine name False systemid IBM,011037D1F Hardware system identifier False boottype disk N/A False SW_dist_intr false Enable SW distribution of interrupts True cpuguard disable CPU Guard True frequency 93750000 System Bus Frequency False
Note: The same information is available in a more readable format by using SMIT. Select the System Environments -> Change / Show Characteristics of Operating Systems options to view this information.
파일
| 파일 | 설명 |
|---|---|
/usr/sbin/lsattr |
lsattr 명령 |
영어 원문
- /usr/sbin/lsattr — Contains the lsattr command.
Related reference:
- lsconn Command
- lsdev Command
Related information:
- chdev command
- Tunable parameters
리눅스(GNU)와 다른 점
리눅스에는 ODM 같은 장치 구성 데이터베이스가 없고, 장치는 커널과 udev가 자동으로 인식합니다. 장치 목록은 lspci, lsusb, lsblk, lshw, ip link로, 속성은 /sys 아래 파일이나 udevadm info로 봅니다. 장치 다시 찾기는 echo "- - -" > /sys/class/scsi_host/host0/scan이나 rescan-scsi-bus.sh가 cfgmgr에 가깝습니다. AIX lsattr -El sys0의 시스템 한도는 리눅스에서 ulimit -a, sysctl -a로, 디스크 큐 깊이 같은 값은 /sys/block/sdX/device/queue_depth로 봅니다.