swcons Command

Purpose

Redirects, temporarily, the system console output to a specified device or file.

Syntax

swcons  [ -p Log_File ] [ -s Log_Size ] [ -t Tag_Verbosity ] [ -v Log_Verbosity ] PathName

Description

The swcons command temporarily switches the system console output to a different target during system operation. This command only switches system informational-, error-, and intervention-required message output to the specified destination. The swcons command does not affect the operation of the system console device that is providing a login by way of the getty command.

The device or file specified when using this command remains the target for console output until changed by another swcons command, until the next start of the system, or until the console driver detects an error when accessing the designated device or file. If an open or write error is detected on the device or file specified by the swcons command, the console device driver switches all output back to the device or file that provided console support when the system was last started.

The PathName parameter must be a fully qualified path name to a device or file that is to receive system console message output. If the PathName parameter specifies a file that does not exist, the swcons command creates the file. If the file does exist, the swcons command appends any new console message output to the contents of the file.

Attention: Use of the swcons command to switch console output to an NFS mounted file system or a diskless/dataless client might cause the operating system to hang.

Flags

Item Description
-p Log_File Specifies the full path name to use for the console output log file.
-s Log_Size Specifies the size, in bytes, of the console output log file.
-t Tag_Verbosity Specifies the verbosity level for console output tagging. Zero disables tagging; 1 through 9 enable tagging. For additional information about console output logging and tagging, see the console Special File in the AIX® Version 7.1 Files Reference book.
-v Log_Verbosity Specifies the verbosity level for console output logging. Zero disables logging; 1 through 9 enable logging.

Security

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 AIX Version 7.1 Security. For a list of privileges and the authorizations associated with this command, see the lssecattr command or the getcmdattr subcommand.

Examples

  1. To change the system console message output to a file called console.out in the /tmp directory, enter:
    swcons /tmp/console.out
  2. To change the system console message output to a terminal with the logical name tty3, enter:
    swcons /dev/tty3
  3. To change the system-console message output back to the device or file that supported the console output at system start time, enter:
    swcons

Files

Item Description
/dev/console Specifies the special file for system console access.
/usr/sbin/swcons Contains the swcons command file.