In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly explains "how to set the color of Ubuntu Linux terminal". Friends who are interested may wish to have a look. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn how to set the color of the Ubuntu Linux terminal.
One of the greatest advantages of Linux is that you can customize your favorite system configuration according to your personal preferences. For example, the terminal color setting is a classic example.
For students who use Ubuntu for the first time, open the terminal (the shortcut key is Ctrl + Alt + T), and you will find that the user name and hostname on the command line are all white. Of course, there will be one more color when we use ls to list files. But it's not efficient for developers because sometimes you need to go to dozens or even hundreds of lines of code to find commands you've run or information you want. Therefore, the terminal (Terminal) color matching also becomes very important.
The example operating system for this article is: Ubuntu 18.04LTS
For the user's configuration, we should write the configuration information to the ~ / .bashrc file.
1. Color configuration
To set the terminal color, we need to customize the PS1 variable in the ~ / .bashrc file. First, open the file with the "vim ~ / .bashrc" command and find the location of the PS1 variable:
PS1 variable in bashrc file
The image above is the color setting of the command line prompt that we need to modify.
Comment out # force_color_prompt=yes. When color mode is turned on, the PS1 variable represents the user name + hostname + pathname (long path) + $
PS1='$ {debian_chroot:+ ($debian_chroot)}\ u @\ h:\ w\ $'
Now, we need to set the font color of the displayed information, first take a look at how the color is set:
A separate color setting:\ 033 [code; foreground; background m, for example:\ [\ 033 [1position 32x 40m\] indicates that the highlighted font is green and the background color is black.
Note: the color setting should be placed in front of the corresponding setting, such as the user name color setting:\ [033 [01bot 3510 40m\]\ u
We can replace the first PS1 with the following code:
PS1='$ {debian_chroot:+ ($debian_chroot)}\ [\ 033 [01Trachet40m\]\ u\ [\ 033 [0010x 40m\] @\ [\ 033 [01x 35th 40m\]\ h\ [\ 033 [0010x 40m\]:\ [0033 [0010x 40m\]\ w\ [\ 033 [0132th 40m\]\ $\ [\ 033 [01it36x 40m\]'
Or we can replace the first PS1 with the following code
# PS1='\ [\ e [31t1m\]\ u\ [\ e [31ET1m\]\ u\ [\ e [34ET1m\] @\ [\ e [32MT1m\]\ h\ [\ e [31WT1m\]\ w\ [\ e [33trans1m\]\ t\ [\ e [37trans1m\]]\ [\ e [32trans1m\]\ $\ [\ e [m\]'
Then you restart the terminal and you can see the color matching effect just now, or you can run the new color matching terminal by executing the source ~ /. Bashrc command. As follows:
The following is a specific analysis of the setting of the PS1 variable. First of all, we need to know the following tables:
Let's talk about the process of color matching:
Foreground background color
30 40 black
31 41 pale color
32 42 shades
33 43 shades
34 44 shades
35 45 purplish purple
36 46 cyan
37 47 White
1 transparent color
Code meaning
0 OFF
1 highlight
4 underline
5 flicker
7 anti-white display
8 not visible
I personally prefer to set the terminal box to translucent, in the terminal menu → edit → preferences → unnamed → color, choose a transparent background, set to the transparency you like.
The effect picture is as follows:
Some fonts suitable for the terminal:
[linuxmi@linux:~/Linux fan $] sudo apt-get install ttf-dejavu [linuxmi@linux:~/Linux fan $] sudo apt-get install xfonts-terminus
At this point, I believe that everyone on the "Ubuntu Linux terminal color setting" have a deeper understanding, might as well to the actual operation of it! Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.