[ Bottom of Page | Previous Page | Next Page | Contents | Index | Library Home | Legal | Search ]

Commands Reference, Volume 2

getdev Command

Purpose

Lists devices that match the specified criteria.

Syntax

getdev [ -a ] [ -e ] [ Criteria] [ DeviceList ]

Description

Lists devices that match the given criteria. The criteria is given in the form of expressions. The getdev command can check all devices on the system or a specified list of devices.

Flags

-a Specifies that a device must match all criteria to be included in the list generated by this command. The -a flag has no effect if no criteria are defined.
-e Specifies that the devices provided in the devicelist be excluded from the list generated by the getdev command. Without the -e flag only devices in the devicelist are generated. This flag is ignored if no devices are specified.

Parameters

Criteria Defines criteria that a device must match before it can be included in the generated list. Criteria can be specified as an expression or a list of expressions which a device must meet for it to be included in the list generated by getdev. If no criteria are provided, all devices are included in the list.

Devices must satisfy at least one of the criteria in the list. However, the -a option can be used to specify that a "logical and" operation should be performed. Then, only those devices that match all of the criteria in a list will be included.

There are four possible expression types which the criteria specified in the Criteria parameter may follow:

Attribute=Value
Fetches all devices with a member which hasAttribute defined and is equal to Value.
Attribute!=Value
Fetches all devices with a member which has Attribute defined and does not equal Value.
Attribute:*
Fetches all devices with a member which has Attribute defined.
Attribute!:*
Fetches all devices with a member which does not have Attribute defined.

The following are the valid device attributes:

alias
The name by which a device is known.
desc
A description of the device.
type
A token describing the type of the device.
status
The current state of the device.
DeviceList Specifies a space-separated list of devices to be checked for the Criteria.

Exit Status

0
The command completed successfully
> 1
Failure has occurred.

Examples

  1. To display all devices, enter:
    getdev
  2. To list devices which are of type "lvtype", enter:
    getdev type=lvtype
  3. To list devices which are not of type "lvtype", enter:
    getdev type!=lvtype
  4. To list devices which are of type "lvtype" or whose device alias is "sys0", enter:
    getdev type=lvtype alias=sys0
    The output will look similar to the following:
    hd1 
    hd2 
    hd3 
    hd4 
    ... 
    sys0
  5. To list devices which are of type "lvtype" and whose device alias is "lv01" , enter:
    getdev -a type=lvtype alias=lv01
  6. To display devices for which the status attribute is defined , enter:
    getdev status:*
  7. To display devices for which the desc attribute is not defined , enter:
    getdev desc!:* 

Files

/usr/sbin/getdev Contains the getdev command

Related Information

The getdgrp command, lsdev command.

[ Top of Page | Previous Page | Next Page | Contents | Index | Library Home | Legal | Search ]