In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly introduces "how to modify the Linux command prompt according to your own habits". In the daily operation, I believe many people have doubts about how to modify the Linux command prompt according to their own habits. The editor consulted all kinds of materials and sorted out simple and easy-to-use methods of operation. I hope it will be helpful for you to answer the doubts of "how to modify the Linux command prompt according to your own habits". Next, please follow the editor to study!
The original [root@localhost] $is unavoidably tiresome after watching it for a long time. If you modify it according to your own habits, you can not only look comfortable, but also improve the "pressure". The following editor will introduce you in detail how to modify the Linux command prompt in accordance with your own habits. I hope it will be helpful to you!
Beautify Bash
1. Under the directory:
Vim .bashrc
Note: don't miss that point.
Then write to the end:
Export PS1= "\ u:\ w\\ $"
Note: there are no spaces at both ends of the equal sign.
After the modification is made, save and exit.
If you don't have .bashrc yourself, just copy the following into it.
# .bashrc
If [- f / etc/bashrc]; then
. / etc/bashrc
Fi
Export PS1= "\ u:\ w\\ $"
2. Now let's explain:
Export PS1= "\ u:\ w\\ $"
\ u indicates the user name
\ w indicates that the full path is displayed (the home directory is still abbreviated to "~", for example, ~ / bin/test)
\ W represents the Basename that displays the current path (for example, test)
\ h means host (the original localhost)
\ $indicates the prompt
\\ indicates a backslash
More content can be used:
Man bash
Then look for PS1 (as shown in the figure below, you can make various settings).
3. Finally, let's talk about the problem of color setting. You can put something like\ u on it:
\ [\ e [1x 34m\]\ u\ [\ e [m\]
In something like this. It will have a color. It looks complicated, but you can think of it as a parenthesis. If you wrap something in it, it will have color. The numbers inside are used to set the color.
For example, I set:
\ [\ e [1bot 34m\]\ u\ [\ e [m\]:\ w\\ $
Then the figure is as follows:
4. The first 1 indicates the highlight, and the following number is the color. Below, I tested several groups of colors for reference.
Change to another Shell
1. It is good to beautify Bash. You can also experience it with a different Shell. For example, the editor uses Zsh, as shown in the picture.
2, the picture is a screenshot of the .zshrc configuration file of zsh, which is similar to .bashrc, but with different syntax and functions, zsh is more powerful, you can go to the official website or technical blog to learn more about the use of zsh.
Note: be sure to use the Oh-my-zsh plug-in to enhance your zsh, specific methods:
Wget https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh-O-| sh
Matters needing attention
In addition to zsh, fish is also an excellent shell.
At this point, the study of "how to modify the Linux command prompt according to your own habits" 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.
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.