Example Commands and Command Options

This section provides examples of commands and options used with projects and tasks.

Command Options Used With Projects and Tasks

ps Command

Use the ps command with the -o option to display task and project
IDs. For example, to view the project ID, type the following:

# ps -o user,pid,uid,projid
USER PID UID PROJID
jtd 89430 124 4113

id Command

Use the id command with the -p option to print the current project
ID in addition to the user and group IDs. If the user
operand is provided, the project associated with that user's normal login is printed:

# id -p
uid=124(jtd) gid=10(staff) projid=4113(booksite)

pgrep and pkill Commands

To match only processes with a project ID in a specific list,
use the pgrep and pkill commands with the -J option:

# pgrep -J projidlist
# pkill -J projidlist

To match only processes with a task ID in a specific list,
use the pgrep and pkill commands with the -T option:

# pgrep -T taskidlist
# pkill -T taskidlist

prstat Command

To display various statistics for processes and projects that are currently running on
your system, use the prstat command with the -J option:

Using cron and su With Projects and Tasks

cron Command

The cron command issues a settaskid to ensure that each cron, at, and
batch job executes in a separate task, with the appropriate default project
for the submitting user. The at and batch commands also capture the current project
ID, which ensures that the project ID is restored when running an at
job.

su Command

The su command joins the target user's default project by creating a new
task, as part of simulating a login.

To switch the user's default project by using the su command, type the
following: