lscons Command

Purpose

Writes the name of the current console device to standard output.

Syntax

lscons [ -s ] [ -a | -O ]

lscons -b [ -s ] [ -a | -O ]

lscons -d [ -s ]

Description

The lscons command writes the name of the current console device to standard output. This command is also used to write the name of the device that is to be the console on the next start of the system to standard output. You can change the current console device using the swcons command. You can change the device to be the system console on the next start of the system using the chcons command.

Flags

Item Description
-a Displays a list of attribute name = attribute value pairs for the console device and console logging and tagging attributes. When used with the -b flag, the values are retrieved from the ODM. Without the -b flag, the values are retrieved from the console device driver. For additional information about console output logging and tagging, see the console Special File in the AIX® Version 7.1 Files Reference book.
Note: This flag is not valid with the -O flag or the -d flag.
-b Displays the full path name of the system console selected for the next startup of the system.
-d Displays the full path name of the system console selected on the current startup of the system.
Note: This flag is not valid with the -O flag or the -a flag.
-O Similar to the -a flag but outputs the attribute names and values in a format suitable for use by SMIT. This flag is NOT valid with the -d flag.
Note: This flag is not valid with the -d flag or the -a flag.
-s Suppresses reporting of the path name.

Exit Status

This command returns the following exit values:

Item Description
0 The device you are using is the current system console.
1 The device you are using is not the current system console.
2 The device you are using is the console device selected at system start but is not currently the device supporting console message output.
3 Flags specified are not valid.
4 System error occurred.

Examples

  1. To display the full path name of the current system console, type:
    lscons
  2. To display the full path name of the system console effective on the next startup of the system, type:
    lscons  -b
  3. To display the full path name of the system console selected on the current startup of the system, type:
    lscons -d
  4. To test whether or not the current system console is directed to your display, type:
    if lscons -s
    then
    echo "System messages are directed to my display" >/dev/tty
    fi

Files

Item Description
/usr/sbin/lscons Contains the lscons command.