조회 수 32195 댓글 0
?

단축키

Prev이전 문서

Next다음 문서

+ - Up Down Comment Print
?

단축키

Prev이전 문서

Next다음 문서

+ - Up Down Comment Print
echo -e "\033[COLOR1;COLOR2m sample text\033[0m"

[ TEXT ATTRIBUTES ]
  ANSI CODE           Meaning
        0          Normal Characters
        1          Bold Characters
        4          Underlined Characters
        5          Blinking Characters
        7          Reverse video Characters


[ COLORS ]
Bold offcolorBold oncolor
0;30Balck1;30Dark Gray
0;31Red1;31Dark Red
0;32Green1;32Dark Green
0;33Brown1;33Yellow
0;34Blue1;34Dark Blue
0;35Magenta1;35Dark Magenta
0;36Cyan1;30Dark Cyan
0;37Light Gray1;30White

ColorForegroundBackground
black3040
red3141
green3242
yellow3343
blue3444
magenta3545
cyan3646
white3747


$ echo -e '\E[47;34m'"\033[1mE\033[0m"
흰색배경에 파란색 글씨로 m이라고 출력됨


echo -e "\033[COLORm Sample text"

The "\033[" begins the escape sequence.You can also use "\e[" instead
of "\033[". COLOR specifies a foreground color, according to the table
above.The "m" terminates escape sequence, and text begins immediately
after that.

Note: With an echo, the -e option enables the escape sequences.You can
also use printf instead of echo.


printf "\e[COLORm sample text\n"

To print Green text

echo -e "\033[32m Hello World"
             or
printf "\e[32m Hello World"

정상으로 돌아오려면
echo -e "\033[0m"


[ Some examples ]
Block background and white text
echo -e "\033[40;37m Hello World\033[0m"


Reverse video text attribute option interchanges fg and bg colors.
Bellow statement prints block on white
echo -e "\033[40;37;7m Hello World\033[0m"
echo -e "\033[33;44m Yellow text on blue background\033[0m"
echo -e "\033[1;33;44m Bold yellow text on blue background\033[0m"
echo -e "\033[1;4;33;44mBold yellow underlined text on blue background\033[0m"


[ The "tput" command: ]
Other than echo there is a command called tput using which we
can control the way the output is displayed on the screen.But it is
less flexible than ANSI escape sequences.

[ SCRIPT SAMPLE ]
#!/bin/bash
# This script echoes colors and codes

echo -e "\n\033[4;31mLight Colors\033[0m  \t\t\033[1;4;31mDark Colors\033[0m"

echo -e "\e[0;30;47m Black    \e[0m 0;30m \t\e[1;30;40m Dark Gray  \e[0m 1;30m"
echo -e "\e[0;31;47m Red      \e[0m 0;31m \t\e[1;31;40m Dark Red   \e[0m 1;31m"
echo -e "\e[0;32;47m Green    \e[0m 0;32m \t\e[1;32;40m Dark Green \e[0m 1;32m"
echo -e "\e[0;33;47m Brown    \e[0m 0;33m \t\e[1;33;40m Yellow     \e[0m 1;33m"
echo -e "\e[0;34;47m Blue     \e[0m 0;34m \t\e[1;34;40m Dark Blue  \e[0m 1;34m"
echo -e "\e[0;35;47m Magenta  \e[0m 0;35m \t\e[1;35;40m DarkMagenta\e[0m 1;35m"
echo -e "\e[0;36;47m Cyan     \e[0m 0;36m \t\e[1;36;40m Dark Cyan  \e[0m 1;36m"
echo -e "\e[0;37;47m LightGray\e[0m 0;37m \t\e[1;37;40m White      \e[0m 1;37m"



[ANSI 문자]

DecabbrcmdechoNoteDecabbrcmdechoNoteDecabbrcmdechoNote
0NUL^@x

12FF^L

24CAN^X

1SOH^A

13CR^Mx줄바꿈25EM^Y

2STX^B

14SO^N

26SUB^Zx

3ETX^C

15SI^O

27ESC^[

4EOT^D

16DLE^P

28FS^\

5ENQ^E

17DC1^Q

29GS^]

6ACK^F

18DC2^R

30RS^^

7BEL^G소리

19DC3^S

31US^_

8BS^H지우기

20DC4^T

32SP공백공백공백
9HT^Ix21NAK^U

127DEL^?

10LF^Jx

22SYN^V

11VT^K

23ETB^W

x 사용할 수 없거나 Null 값으로 처리됨.
* ASCII Code 8 은 BackSpace 로 배치 파일에서 사용되면 의미 그대로 앞의 한 글자를 지웁니다.
* 명령 프롬프트의 Echo 출력 결과는 Color F0 으로 설정한 후 캡쳐한 것입니다.
TAG •

Dreamy의 코드 스크랩

내가 모으고 내가 보는

List of Articles
번호 분류 제목 날짜 조회 수 추천 수
401 Android Wifi을 이용한 adb 연결 2012.02.28 20884 0
400 LINUX 간단 UNIX / LINUX 명령어 정리 2012.02.28 17115 0
399 개념 UDS (Unix Domain Socket) 2012.02.28 32158 0
398 일반 CSS 참고 사이트 2012.06.05 15398 0
397 개념 SEI(Supplemental Enhancement Information) - H.264, AVC 2012.03.29 18198 0
396 개념 CMLA (Content Management Licensing Administrator) DRM 2012.03.30 15457 0
395 C# 문자열 다루기 1 2012.04.06 18559 0
394 C# C# 형변환 (문자형 -> 숫자형) / C# Type Change (string -> number) 2012.04.12 57323 0
393 Android logcat 사용법 2012.04.12 36116 0
392 LINUX zip 명령어 사용법 1 2012.04.16 28597 0
391 C# C# ?? 및 ??=, ?. 연산자 2021.05.09 3108 0
390 Android [GIT 사용법] Dreamy의 요약 2 secret 2012.04.20 158 0
389 LINUX KScope 사용법 2012.04.23 15117 0
388 개념 CSFB와 SVLTE (Circuit Switched Fall-Back & Simultaneous Voice and LTE) 2012.04.23 24290 0
387 Android Git 사용자 설명서 2012.04.24 16016 0
목록
Board Pagination ‹ Prev 1 ... 3 4 5 6 7 8 9 10 11 12 ... 34 Next ›
/ 34

나눔글꼴 설치 안내


이 PC에는 나눔글꼴이 설치되어 있지 않습니다.

이 사이트를 나눔글꼴로 보기 위해서는
나눔글꼴을 설치해야 합니다.

설치 취소

Designed by sketchbooks.co.kr / sketchbook5 board skin

Sketchbook5, 스케치북5

Sketchbook5, 스케치북5

Sketchbook5, 스케치북5

Sketchbook5, 스케치북5