Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to realize Linux terminal beautification

2025-02-14 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly introduces "how to achieve Linux terminal beautification". In daily operation, I believe many people have doubts about how to achieve Linux terminal beautification. The editor consulted all kinds of materials and sorted out simple and easy-to-use operation methods. I hope it will be helpful for you to answer the doubts about "how to achieve Linux terminal beautification". Next, please follow the editor to study!

Green font output:

The code is as follows:

Echo-e "\ 033 [132 countries 40mPass\ 033 [0m"

Red font output:

The code is as follows:

Echo-e "\ 033 [1 * * 31 * 40 mFail\ 033 [0m"

The color of the text terminal can be generated using a "ANSI unconventional character sequence". For example:

The code is as follows:

Echo-e "\ 033 [4437 witch 5m ME\ 033 [0m COOL"

The above command settings are as follows: the background color is blue, the foreground color is white, the font flashes, the output character "ME", then reset the screen to the default setting, output the character "COOL". " E "is an option for the command echo, which is used to activate the parser for special characters." \ 033 "Boot unconventional character sequence." M "means to set the property and then end the unconventional character sequence, and the really valid characters in this example are" 44 / 44 / 37 / 5 "and" 0 ". The combination of different colors can be generated by modifying "44th / 37th / 5". The numerical value has nothing to do with the order before and after the coding.

The parameters that can be selected are as follows:

Color code:

QUOTE:

Word background color range: 40Mel 49 words color: 30Mel 39

40: black 30: black

41: red 31: red

42: green 32: green

43: yellow 33: yellow

44: blue 34: blue

45: purple 35: purple

46: dark green 36: dark green

47: White 37: White

ANSI control code:

QUOTE:

\ 033 [0m turn off all properties

\ 033 [1m set high brightness

\ 03 [4m underline

\ 033 [5m flicker

\ 033 [7m reverse display

\ 033 [8m blanking

\ 033 [30m--\ 033 [37m set foreground color

\ 033 [40m--\ 033 [47m set background color

\ 033 [nA cursor up n lines

\ 03 [nB cursor down n lines

\ 033 [nC cursor move to the right n lines

\ 033 [nD cursor move left n lines

\ 033 [ytrexh sets the cursor position

\ 033 [2J clear screen

\ 033 [K clear the contents from the cursor to the end of the line

\ 033 [s Save cursor location

\ 033 [u restore cursor position

\ 033 [? 25l hide the cursor

\ 33 [? 25h display cursor

Some specific excerpts are as follows:

\ 033 [0m turn off all properties

\ 033 [1m set high brightness

\ 033 [4m underline

\ 033 [5m flicker

\ 033 [7m reverse display

\ 033 [8m blanking

\ 033 [30m--\ 033 [37m set foreground color

\ 033 [40m--\ 033 [47m set background color

\ 033 [nA cursor up n lines

\ 033 [nB cursor down n lines

\ 033 [nC cursor move to the right n lines

\ 033 [nD cursor move left n lines

\ 033 [ytrexh sets the cursor position

\ 033 [2J clear screen

\ 033 [K clear the contents from the cursor to the end of the line

\ 033 [s Save cursor location

\ 033 [u restore cursor position

\ 033 [? 25l hide the cursor

\ 033 [? 25h display cursor

[M sets the display property. The same sequence can set one or more properties.

Par action

0 all properties are reset to their default values

1 set the border www.yisu.com

2 set the brightness to be halved (using one color to simulate another color)

4 set shading (use one color to simulate another color)

(the color used for simulation is made by using ESC]. Settings)

5 set flicker

7 set reverse video (reverse video)

10 reset the selected image to display the control flag

Reverses element tags.

11 Select an empty image and set the display control flag

Resets the reverse flag.

12 Select an empty image and set the display control flag

Resets the reverse flag. (after completing the image table transfer

Before reversing the flag causes each byte's

High reversal.)

21 set normal brightness (incompatible with ECMA-48)

22 set normal brightness

24 turn off the underline

25 No flicker

27 reverse video off

30 black foreground

31 red foreground

32 green prospect

33 Brown foreground

34 Blue foreground

35 fuchsin prospect

36 Peacock Blue Prospect

37 White foreground

38 turn on the underline and set the default foreground color

39 turn off the underline and set the default foreground color

40 Black background

41 red background

42 Green background

43 Brown background

44 blue background

45 magenta background

46 Peacock blue background

47 White background

49 set the default background color

At this point, the study on "how to beautify the Linux terminal" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report