조회 수 32187 댓글 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 LINUX [Shell Script] 쉘 프로그래밍을 위한 명령어 file 2015.04.30 7319 0
400 LINUX bash 의 명령어 History 2015.01.20 7353 0
399 LINUX 리눅스 계정 목록 보기 2016.03.21 7369 0
398 LINUX 우분투(Ubuntu)에서 APM 웹서버 구축하기 2016.03.17 7408 0
397 Pi Simple DAC - PWM을 Voltage로 변환하는 회로 file 2016.11.21 7465 0
396 Android JNI에서 가변 인수(varargs) 쓰기 2014.08.04 7547 0
395 Pi ARDUINO multi function shield 핀정보 및 FND 소스 2016.11.21 7557 0
394 일반 VP9 코덱 2015.09.01 7581 0
393 JAVA 자바 프로그래머가 알아야할 10가지 이클립스 단축키 1 2015.10.27 7652 0
392 Android gdb commands 2015.03.11 7655 0
391 Pi 라즈베리파이 적외선(IR) 리모컨 송신/수신 - LIRC Library 2017.10.17 7723 0
390 PHP Simple GD example 2014.07.10 7790 0
389 JAVA 현재시간 구하기 2015.10.21 7812 0
388 일반 NirCmd 사용법 2015.12.08 7829 0
387 일반 SQL Injection 우회 정리 2019.07.10 7976 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