2013-10-14 02:36:58 +00:00
|
|
|
---
|
|
|
|
title: Ansi codes
|
2015-11-24 05:06:06 +00:00
|
|
|
category: CLI
|
2020-07-03 12:47:47 +00:00
|
|
|
intro: |
|
|
|
|
Quick reference to ANSI color codes.
|
2013-10-14 02:36:58 +00:00
|
|
|
---
|
2013-10-14 01:55:21 +00:00
|
|
|
|
2020-07-03 12:47:47 +00:00
|
|
|
### Format
|
2013-10-14 01:55:21 +00:00
|
|
|
|
2020-07-03 12:47:47 +00:00
|
|
|
```
|
|
|
|
\033[#m
|
|
|
|
```
|
2013-10-14 01:55:21 +00:00
|
|
|
|
2020-07-03 12:47:47 +00:00
|
|
|
### ANSI codes
|
2013-10-14 01:55:21 +00:00
|
|
|
|
2020-07-03 12:47:47 +00:00
|
|
|
```
|
|
|
|
0 clear
|
|
|
|
1 bold
|
|
|
|
4 underline
|
|
|
|
5 blink
|
2013-10-14 01:55:21 +00:00
|
|
|
|
2020-07-03 12:47:47 +00:00
|
|
|
30-37 fg color
|
|
|
|
40-47 bg color
|
2013-10-14 01:55:21 +00:00
|
|
|
|
2020-07-03 12:47:47 +00:00
|
|
|
1K clear line (to beginning of line)
|
|
|
|
2K clear line (entire line)
|
|
|
|
2J clear screen
|
|
|
|
0;0H move cursor to 0;0
|
2014-02-25 10:32:14 +00:00
|
|
|
|
2020-07-03 12:47:47 +00:00
|
|
|
1A move up 1 line
|
|
|
|
```
|
2014-08-12 04:03:16 +00:00
|
|
|
|
2020-07-03 12:47:47 +00:00
|
|
|
### Colors
|
2013-10-14 01:55:21 +00:00
|
|
|
|
2020-07-03 12:47:47 +00:00
|
|
|
```
|
|
|
|
0 black
|
|
|
|
1 red
|
|
|
|
2 green
|
|
|
|
3 yellow
|
|
|
|
4 blue
|
|
|
|
5 magenta
|
|
|
|
6 cyan
|
|
|
|
7 white
|
|
|
|
```
|
2014-03-26 04:09:02 +00:00
|
|
|
|
2020-07-03 12:47:47 +00:00
|
|
|
### Bash utilities
|
2014-03-26 04:09:02 +00:00
|
|
|
|
2020-07-03 12:47:47 +00:00
|
|
|
```sh
|
|
|
|
hide_cursor() { printf "\e[?25l"; }
|
|
|
|
show_cursor() { printf "\e[?25h"; }
|
|
|
|
```
|