Strovent SystemsSign in
Reference

IBM i shells: QSH, QP2TERM or SSH, and which to use

IBM i has two Unix-style shells. QSH starts Qshell; CALL QP2TERM starts the PASE Korn shell on a 5250 screen; SSH gives you a PASE shell in a real terminal.

IBM i has two environments that look like a Unix shell, and three common ways to reach them. They are not the same shell, and they behave differently on a 5250 screen.

Qshell: QSH or STRQSH

Qshell is IBM i's own command environment based on the POSIX and X/Open standards. It has its shell interpreter (qsh) and its own utilities in /usr/bin. Type on any command line:

QSH

(STRQSH is the same command.) A Qshell terminal window opens, with an input line at the bottom and an output area above. At the start of a new session, qsh runs /etc/profile, then .profile in your home folder.

The function keys matter:

| Key | What it does in Qshell | |---|---| | F3 | Exit: closes the window and ends the Qshell session | | F12 | Disconnect: closes the window but keeps the session; run QSH again to return to it | | F9 | Retrieve a previous command | | F7 / F8 | Roll the output up or down | | F21 | A window for CL commands | | SysReq then 2 | Interrupt the running command (SIGINT) |

QSH CMD('ls /home') runs one Qshell command and returns, which is how CL programs call it.

PASE: CALL QP2TERM

IBM PASE for i runs AIX programs on IBM i. It brings its own Korn, Bourne and C shells and its own utilities, in /QOpenSys/usr/bin. Start an interactive PASE shell from a command line with:

CALL QP2TERM

You get the default PASE shell, the Korn shell /QOpenSys/usr/bin/sh. The commands run in a separate batch job, and the 5250 screen shows their output and takes your input. That input and output pass through pipes, not a terminal, so QP2TERM suits commands that print lines. Programs that draw a full screen, such as vi, top or less, expect a terminal.

Many PASE and Qshell utilities share names, such as ls or grep, with similar options. Which one you get depends on which environment you are in and on PATH.

SSH: a PASE shell in a real terminal

If the IBM i SSH server is running, an SSH login gives you a PASE shell in a VT terminal, the same as on a Linux host. As on other Unix systems, sshd gives an interactive login a pseudo-terminal. The shell used is set per user profile; if logins fail, see IBM i SSH "Permission denied": home, key permissions, PASE shell.

In an SSH session the keys are VT keys: 5250 function keys such as F3 or Field Exit are not used. See What Ctrl does in a 5250 emulator, and why IBM i never sees a Ctrl key.

Which to use

Sources

Spotted a mistake? Email [email protected].