Terminal Commands

  • capture
  • chcons – change assignment of system console
  • lscons – display current console assignment
  • swcons – temp change assignment of system console
  • syslog.conf – capture error messages
  • tic – create terminfo files
  • tput – use terminal attributes
  • reset – reset port

Handshaking

RTS/CTS
The 64-port adapter will support ASCII terminals and printers at the 38400
baud rate if the RTS/CTS flow control mechanism is enabled.
RTS/CTS is not checked by AIX unless RTS is added to the printer
stack. To enable RTS/CTS use the command…
stty add rts /dev/ttyx
where ‘x’ is replaced by the number of the tty port for which you wish to enable RTS/CTS.

DTR/DCD
>Assumming a getty process is running on a terminal port and that terminal is turned on, when the ps -ef command is run and a question mark (?) appears in the TTY field, a cabling problem exists.

  • Most likely, the DTR lead from the terminal is NOT connected to the DCD lead on the RS/6000 end. By default, ALL terminal ports on the RS/6000 are configured as DCE or modem ports. This means that NO output will travel out that port until the DCD (carrier detect) goes high.
  • Thats why the DTR lead on the terminal needs to be mapped to the RS/6000 DCD lead. Once the terminal is turned on, the DTR lead goes high, causing the DCD lead to go high, resulting in the RS/6000 generating a login prompt on that terminal.
    Once this happens, you will see a TERMINAL ID in the TTY field when the ps -ef command is executed. When the terminal is turned off, a question mark (?) will be displayed in this field.

Modem Control
To turn off modem control, the clocal attribute must be turned off for the LOGMODES and RUNMODES fields. This must be done if your only using 3-wire cabling and no looping back of the the DTR and DCD leads is being performed at the RS/6000 end. This can visually be seen by viewing the output of the ps -ef command. The TTY field will always have a TERMINAL ID number in it, regardless of whether the terminal is turned on, off, or no cable is attached to the terminal. One consideration when disabling modem control; beware that when you login to a terminal port, followed by turning the terminal off and back on again, you still will be logged in. Since DCD does not drop (remember it’s looped back to DTR – which stays high), the RS/6000 terminal drivers will not terminate any programs that are running on that port.

top of page


capture

Utility that allows you to capture screen output. Bring up the application/utility whose screen you wish to capture, followed by pressing ^P, to flush the screen contents to a file named screen.out. Use the -a flag to either write to a new file or append to an existing file. Type exit to exit this command.

Example: capture -a CRT.dump (Captures all screen output until ‘exit’ is typed at command line.)

top of page


chcons

Changes the system console device to be effective on the next system reboot.

Example: chcons -a login=enable /dev/tty0

top of page


chdev

Change one or more attributes for a specific device configuration

Examples What it does
chdev -l tty1 -a logger=/bin/smit The next time the system is rebooted, that terminal is either turned on or the current user logs off, the smit command will automatically be executed instead of the login prompt being displayed.
chdev -l tty1 -a logger=’;’ To disable automatically executing a command when a terminal has been turned on.
chdev -l tty4 -a altpin=enable Switches the location of the DSR and DCD inputs on the modular connector, so that DCD is available when using an 8-pin RJ-45 connector instead of the 10-pin RJ-45 connector.

top of page


lscons

Displays the name of the current console device.

top of page


pdelay

When a terminal port is configured to have a login status of pdelay, this means that a carriage return or two is required to be pressed prior to a login prompt being generated to the display terminal. Without a carriage return being generated, the display screen will remain blank.

Examples What it does
pdelay Reports back all the terminals that have a pdelay status
pdelay tty21 Sets terminal (tty21) to have a login status of pdelay

top of page


pdisable

When a terminal port is configured to have a login status of pdisable, a login prompt will not be generated to the display terminal. Keyboard input will not be read because AIX will not generate a process to read input on that port. Effectively, the port is disabled until it’s state is turned to pdelaypenable, or pshare or the system is rebooted.

Examples What it does
pdisable Reports back all the terminals that have a pdisable status
pdisable tty21 Sets terminal tty21 to have a login status of disable. Any processes running on that port will be terminated.
pdisable -a Disable all ports that are currently enabled except PTS and HFT devices (looks for all TTY devices)
pdisable 3 6 19 Disables the ttys 3, 6 and 19 from logging into the system. If there were active users on these ports, the users and associated processes are terminated.

top of page


penable

When a terminal port is configured to have a login status of penable, a login prompt will immediately be displayed on the terminal by the getty process.

Examples What it does
penable Reports back all the terminals that have a penable status
penable tty21 Sets terminal (tty21) to have a penable status
penable -a Enable all ports that were disabled

top of page


phold

Disables or lists the availability of login ports on hold

Examples What it does
phold Lists the ports that are currently on hold
phold -a Holds all ports that are currently enabled. No new users may login.

top of page


pshare

Enables a port for bi-directional use. Typically used for modem ports. The port starts a getty when a CD signal is asserted. A shared port can be used as both a dial-out and dial-in device without user intervention, but the modem must not assert carrier until true carrier is established – else noise maybe picked up, causing TSM to generate error messages.

Examples What it does
pshare Reports back all the terminals that have a pshare status
pshare tty21 Sets terminal tty21 to have a pshare status.

top of page


pstart

Enables or lists the available login ports.

Examples What it does
pstart Lists all enabled ports and their current login status
pstart -a Enables all ports listed in the /etc/inittab file that were enabled, shared, or delayed.

top of page


reset

Re-initializes a terminal. Useful when a program dies and leaves a terminal in an undesirable state. The sequence ^Jreset^J may be required to get the reset command to run successfully, since the RETURN key might not work in this state.

top of page


script

Makes a typescript of everything displayed during a terminal session (captures terminal input and output to a file). Use the -a flag to either write to a new file or append to an existing file.

Example: script

Creates the file ‘typescript’ in your current work directory. Captures all KEYBOARD input and SCREEN output until exit is typed at command line.

top of page


stty

Lists attributes for a terminal. Any changes made by the stty command, remains active until the next reboot. The mkdev or chdev commands make permanent changes for that device and take effect upon the next login.

Examples What it does
stty -a </dev/tty13 List the attribute settings for a terminal that has a user logged on it already
stty get < /dev/lp0 Useful command to determine if the DTR signal is being used to monitor the printer control signal DEVICE_BUSY. If DTR is not being monitored, DTR will not be part of this output.
stty erase Sets your terminal to perform a destructive backspace
stty kill ^U intr ^C susp ^Z Sets terminal to

  • clear entire command line (kill) using ^U
  • terminate a foreground process (intr) by using ^C
  • suspend a foreground process (susp) by using ^Z
stty -hupcl Prevents DTR from dropping when ^D, exit, or logout is generated. This prevents any application running on that port from being terminated.
stty hupcl The hupcl parameter hangs up a dial-up connection. If set, the line is disconnected when the last process closes the line or when the process terminates.
stty opost onlcrstty -opost -onlcr By default, a tty port will translate a NL to CR on output. If your application is generating CRLF for output, the onlcr attribute will change this to a CRCRLF. To disable this feature, reset the port attributes to using: stty -opost -onlcr
stty tostop Prevent a background job from creating output to your terminal. The background job will stop (suspend itself) when it tries to
output to the terminal screen. Same actions will occur if a background job attempts to read standard input.
stty -cread </dev/tty32 Enable reading from the keyboard. If the stty setting for that terminal port is ‘cread’, then a login prompt will be displayed at that terminal but no keyboard input will be read.
stty -icrnl Translate incoming carriage returns (CR, ^M,’\r’) into newlines (LF, ^J,’\n’)
1) OLDTTY=`stty -g </dev/tty`2) stty $OLDTTY < /dev/tty Illustrates how one could save the current tty attributes in a shell variable (OLDTTY) and later restore them.
stty disp bsd Switches from the POSIX (default) to the BSD line discipline.
1) /usr/lbin/tty/ttyconfig -l sptr 2) stty disp sptr </dev/lp3 Switches from the POSIX (default or terminal driver) to the SPTR line discipline (print driver)
stty -ixon -ixoff Disable XON/XOFF for your current terminal session.
stty -cxma Lists attributes for a 128-port terminal. Any changes made by this command remain active until the next reboot. The mkdev or chdev commands make permantent changes for that device and take upon the next login. 128-port adapter supports synchronous modems.
stty-cxma flush </dev/tty4 Immediately flush (discard) tty input and output. Also used to unlock a tty port.
stty-cxma -forcedcd </dev/tty4 Disable carrier sense, so the tty may be opened and used even when carrier is not present.
stty-cxma edelay </dev/tty4 Sets the rate at which the Front End Processor Operating System (FEPOS) wakes up the software on input. The FEPOS will wake up the software every ‘X’ milliseconds. DEFAULT: 10

top of page


swcons

Temporarily sets the system console output to a new terminal device or file. This command switches system informational and error messages and does not affect the operation of the system console that is providing a login capability to the system.

Example: swcons /tmp/console.log

Redirects console messages to a file named /tmp/console.log. In order to enable logging messages to this file after each reboot, make sure that the swcons /tmp/console.log command is the first line executed in the /etc/rc file.

top of page


tic

Compiles the source terminfo files into a compiled format. The terminfo files are found in the /usr/lib/terminfo directory. The source files contain the control codes used to address the hardware specific attributes (cursor addressing, reverse video, underline, backspace, and so on) for each terminal type that AIX supports. The compiled files are used by applications through library routines to hide the hardware specific codes required by each type of terminal.

Examples What it does
1) cd /usr/lib/terminfo2) tic ibm.ti Updates the compiled terminal definitions for all ibm terminals to reflect the latest changes in the /usr/lib/terminfo/ibm.ti file
ls /usr/lib/terminfo/?/* Lists all the terminal types that AIX supports

top of page


Used as a tool to set terminfo attributes for a specific terminal

Examples What it does
tput rev Outputs characters in reverse video
tput sgr0; Restores terminal to default settings
tput smkx Download of function keys
1)
bold=`tput smso`
2) echo “${bold}Enter your password: \c”
Example that can be used in a script that allows one to highlight the text displayed on a screen

top of page


tty

Displays the terminal id (i.e. tty value)

top of page


syslog.conf

To capture error messages that appear on the console to a file, do the following…

  1. vi /etc/syslog.conf
    1. Find the debug line and make it active
    2. Change /dev/console to /tmp/<filename>
    3. Save the changes
  2. Find the current process for syslod: ps -ef |grep syslogd
  3. Kill the process for syslogd
  4. Restart the daemon: /etc/syslogd

top of page