# s command

The s command displays or changes the
semaphore status.

## Syntax

```
s [*|sem]{[?|+|-]}
```

## Parameter(s)

| sem | Specifies the semaphore expressed from 0 to 4. |
| --- | --- |
| * | Specifies all semaphores. |
| + | Sets or locks the specified semaphore. |
| - | Unlocks the specified semaphore. |
| ? | Displays: ```
00: O pid=0985
01: O pib=0023
02:
03: O pib=001A
``` where semaphore 0 is owned by the process with the PID number of x'0985'. Only semaphore 0 displays with the UNIX PID number instead of the D3 PIB number semaphore 1 is busy, owned by the PIB x'23' and has at least one process waiting on it (W). semaphore 2 is free. semaphore 3 is busy, owned by process x'1A' but has no process waiting on it. |
If the owner PIB is not setup when the command is executed,
the message pib=? displays. Re-enter the command again
to set the owner PIB.

---
Source: https://d3codex.com/unix/s-command-lowercase/ - part of the D3Codex reference.
