---
name: "ps_color"
section: "7"
platform: "linux"
package: "procps"
version: "1.12.2"
release: "Debian 1.3 (Bo)"
platforms: ["linux"]
url: "https://new.carta.tech/ps_color"
---

# ps\_color(7)

color support for ps and top The showtask module, which is used by ps and top has support for colorization of tasks. The color markup is controlled by markup hints in $PS\_COLORS resp. $TOP\_COLORS. There is a program called pscol, (similar to dircolors) in a separate package that can be used to set these environment variables. The environment variables should contain a list of entries of the form markup\_type,markup\_value,markup\_string separated by %, where markup\_type is the id of the markup\_type from the following table, markup value is a value of the type corresponding to the markup\_type and markup\_string is an ANSI markupstring consisting of a forground color, a background color or an attribute all separated by a semicolon. Note that next to no check is made whether an output device supports ANSI colors The order of the markup entries is important, as the first recognized will be used. Currently the following markup\_types are recognised by showtask: Attributes can only be defined for a color\_pair, i.e. it is impossible to have a attribute operate on background color only. These are the ANSI names for the attributes. Not always do the names correspond to the actual realisation, e.g. bold usually means bold and bright. Some attributes may have no effect at all. This is allowed by ANSI.

." This file describes color support for showtask, i.e. for ps or top.

## NAME

ps\_color - color support for ps and top

The showtask module, which is used by ps and top has support for colorization of tasks. The color markup is controlled by markup hints in **$PS\_COLORS** resp. **$TOP\_COLORS**. There is a program called  **pscol,** (similar to dircolors) in a separate package that can be used to set these  environment variables.

The environment variables should contain a list of entries of the form **markup\_type,markup\_value,markup\_string** separated by  **%**, where markup\_type is the id of the markup\_type from the following table, markup value is a value of the type corresponding to the markup\_type and markup\_string is an ANSI markupstring consisting of  a forground color, a background color or an attribute all separated by a semicolon.

Note that next to no check is made whether an output device supports ANSI colors The order of the markup entries is important, as the first recognized will be used.

Currently the following markup\_types are recognised by showtask:

| | | | |
| --- | --- | --- | --- |
| **markup\_type** | **id** | c-type | description of the markup margin |
| **g\_mem** | **1** |  | not yet implemented |
| **p\_uid** | **2** | int | any process belonging to user with uid s |
| **p\_stat** | **3** | char | any process with state s |
| **p\_mem** | **4** | int | any process using more than s% phys. memory |
| **p\_cpu** | **5** | int | same as above, but cpu usage |
| **p\_size** | **6** | int | any process alrger than s k |
| **p\_tty** | **7** | char\[4\] | any process having controlling terminal s |

| | | | | | | | | |
| --- | --- | --- | --- | --- | --- | --- | --- | --- |
| **ANSI Color Definitions** |
| color | black | red | green | yellow | blue | magenta | cyan | white |
| fg | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 |
| bg | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 |

Attributes can only be defined for a color\_pair, i.e. it is impossible to have a attribute operate on background color only. These are the ANSI names for the attributes. Not always do the names correspond to the actual realisation, e.g. bold usually means bold and bright. Some attributes may have no effect at all. This is allowed by ANSI.

| | | | | | |
| --- | --- | --- | --- | --- | --- |
| **ANSI Attributes** |
| attribute | bold | underscore | blink | reverse | concealed |
| value | 01 | 04 | 05 | 07 | 08 |

## EXAMPLES

Markup by CPU Usage (from bold blue on white (very little) to bold red on yellow):

**PS\_COLORS**="5,0,01;34;40%5,25,01;34%5,50,32%5,75,31%5,90,01;32;43"

Mark root's processes bold red on black:

**TOP\_COLORS**="2,0,01;32;40"
