In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-21 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly explains "how to modify the path length of the command line prompt path prompt under linux". The content of the article is simple and clear, and it is easy to learn and understand. Please follow Xiaobian's train of thought to slowly deepen, together to study and learn "how to modify the path length of the command line prompt path prompt under linux".
Basically, the default path prompt under the Linux system is the complete path, which is really long and inconvenient, which means that sometimes it may occupy the full width and look dazzling, as in the following example:
Linuxidc@Ubuntu:~/trunk-new/build_dir/target-mips_34kc_uClibc-0.9.33.2/linux-ar71xx_generic/linux-3.10.17/net/netfilter/commercials$
Basically occupy 80% of the width of the terminal, if only can be changed to display only the name of the last folder!
Modify method:
The code is as follows:
Vim / .bashrc
Search PS1
The code is as follows:
If ["$color_prompt" = yes]; then
PS1='$ {debian_chroot:+ ($debian_chroot)}\ [\ 033 [01Ex32m\]\ u@\ h\ [\ 033 [00m\]:\ [\ 033 [01transfer34m\]\ W\ [\ 033 [00m\]\ $'
Else
PS1='$ {debian_chroot:+ ($debian_chroot)}\ u @\ h:\ W\ $'
Fi
Find the text above and notice the value of the environment variable of PS1.\ u is the current user,\ h is the hostname,\ w is the full path, and\ W is the simple path. Just change w to W!
As for whether if or else is effective, you can try both, mine is else effective.
Execute the command after modification
The code is as follows:
$source ~ / .bashrc
It can be applied! The results are as follows
Linuxidc@ubuntu:commercials$
The modified linux prompt path prompt path length is not very short, the theme is clear and easy to remember?
Thank you for your reading, the above is the content of "how to modify the path length of the command line prompt path prompt under linux". After the study of this article, I believe you have a deeper understanding of how to modify the path length of the command line prompt path prompt under linux, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!
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.