The linux command 之定制提示符
一、提示符分解
默认提示符如下所示:
[me@linuxbox ~]$
可以看出它包括我们的用户名、主机名、当前工作目录。提示符是由PS1变量定义的。
[me@linuxbox ~]$ echo $PS1
[\u@\h \W]\$

二、尝试设计提示符
先存储一下原来的提示符:
[me@linuxbox ~]$ ps1_old="$PS1"
查看一下
[me@linuxbox ~]$ echo $ps1_old
[\u@\h \W]\$
先设置一个空的提示符:
[me@linuxbox ~]$ PS1=

提示符仍然在那儿,但是什么都不显示。
PS1="\$ "

三、尝试给提示符添加颜色

<me@linuxbox ~>$ PS1="\[\033[0;31m\]<\u@\h \W>\$ "
<me@linuxbox ~>$

同样背景颜色也可以设置:


保存设置
PS1="\[\033[s\033[0;0H\033[0;41m\033[K\033[1;33m\t\033[0m\033[u\]
<\u@\h \W>\$ "
export PS1
我们可以将提示符添加到.bashrc文件中。
The linux command 之定制提示符的更多相关文章
- 《The Linux Command Line》 读书笔记01 基本命令介绍
<The Linux Command Line> 读书笔记01 基本命令介绍 1. What is the Shell? The Shell is a program that takes ...
- 《The Linux Command Line》 读书笔记04 Linux用户以及权限相关命令
Linux用户以及权限相关命令 查看身份 id:Display user identity. 这个命令的输出会显示uid,gid和用户所属的组. uid即user ID,这是账户创建时被赋予的. gi ...
- 《The Linux Command Line》 读书笔记02 关于命令的命令
<The Linux Command Line> 读书笔记02 关于命令的命令 命令的四种类型 type type—Indicate how a command name is inter ...
- Linux Command Line Basics
Most of this note comes from the Beginning the Linux Command Line, Second Edition by Sander van Vugt ...
- Linux Command Line 解析
Linux Command Line 解析 0 处理模型 Linux kernel的启动包括很多组件的初始化和相关配置,这些配置参数一般是通过command line进行配置的.在进行后续分析之前,先 ...
- 15 Examples To Master Linux Command Line History
When you are using Linux command line frequently, using the history effectively can be a major produ ...
- 10 Interesting Linux Command Line Tricks and Tips Worth Knowing
I passionately enjoy working with commands as they offer more control over a Linux system than GUIs( ...
- Reso | The Linux Command Line 的中文版
http://book.haoduoshipin.com/tlcl/book/zh/ 本书是 The Linux Command Line 的中文版, 为大家提供了多种不同的阅读方式. 中英文双语版- ...
- [笔记]The Linux command line
Notes on The Linux Command Line (by W. E. Shotts Jr.) edited by Gopher 感觉博客园是不是搞了什么CSS在里头--在博客园显示效果挺 ...
随机推荐
- 绿盟-WEB应用漏洞扫描系统
************************************************** WEB应用漏洞扫描系统 一.工具的介绍与使用 ************************** ...
- 前端(二十二)—— vue组件:局部组件、全局组件、父组件数据传到子组件、子组件数据传到父组件、父子组件实现todoList
Vue组件 一.组件介绍 每一个组件都是一个vue实例 每个组件均具有自身的模板template,根组件的模板就是挂载点,根组件也可以显式书写模板,会替换掉挂载点 每个组件模板只能拥有一个根标签 子组 ...
- python将字典列表导出为Excel文件的方法
将如下的字典列表内容导出为Excel表格文件形式: 关于上图字典列表的写入,请参考文章:https://blog.csdn.net/weixin_39082390/article/details/ ...
- element ui 弹出组件的遮罩层在弹出层的上面的解决方法
<el-dialog title="收货地址" :visible.sync="dialogFormVisible" :modal-append-to-bo ...
- jq-demo-楼梯效果
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title> ...
- C# 类中访问修饰符的优先级与用法(public, internal, protected, private)
首先:类成员的访问级别是以类的访问级别为上限的! 也就是类的访问级别低时,类成员的访问级别高也无法突破类的访问级别 public级别,作用域是这个解决方案() internal级别,作用域是整个装配集 ...
- git Web
{ …or create a new repository on the command line echo "# Kotlin" >> README.md git ...
- 自定义类型转换器---转Date类型
在使用springMVC过程中 ,假如页面使用了 <form action="${pageContext.request.contextPath}/user/testDate" ...
- spring mvc hibernate spring 整合的增删改查+后台校验+bootstrap
整合之前先知道大概的思路,首先要知道每个框架的重点要点. 1.首先我们从数据库开始 --创建数据库 create database gs --创建表 create table food ( id ,) ...
- 【Codeforces Round #589 (Div. 2) D】Complete Tripartite
[链接] 我是链接,点我呀:) [题意] 题意 [题解] 其实这道题感觉有点狗. 思路大概是这样 先让所有的点都在1集合中. 然后随便选一个点x,访问它的出度y 显然tag[y]=2 因为和他相连了嘛 ...