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在里头--在博客园显示效果挺 ...
随机推荐
- poj 1905 图形推算+二分
参考博客: 题意: 一根两端固定在两面墙上的杆 受热弯曲后变弯曲 求前后两个状态的杆的中点位置的距离 分析:见博客 代码: #include<stdio.h> #include<io ...
- centos yum 安装 tomcat
1.安装 yum install tomcat 2.卸载 yum remove tomcat 3.地址映射 http://localhost:8080/ /usr/share/tomcat/webap ...
- SpringMVC前后端参数交互
Controller中使用JSON方式有多种 关键在于ajax请求是将数据以什么形式传递到后台 HTTP请求中: 如果是get请求,那么表单参数以name=value&name1=value1 ...
- PHP操作XML方法之SimpleXML
SimpleXML简介 SimpleXML 扩展提供了一个非常简单和易于使用的工具集,能将XML转换成一个带有一般属性选择器和数组迭代器的对象. 举例XML XML结构部分引用自<<深入理 ...
- 设计Twitter的api
355. Design Twitter 题意:设计Twitter的API,实现以下功能. postTweet(userId, tweetId): Compose a new tweet. getNew ...
- Servlet中的Filter怎么使用?
一.Filter简介 Filter也称之为过滤器,它是Servlet技术中最激动人心的技术,WEB开发人员通过Filter技术,对web服务器管理的所有web资源:例如Jsp, Servlet, 静态 ...
- cmd操作SQLService数据库
1.win+R 输入cmd2.输入sqlcmd -s 服务器名称3. 1> 输入 use 数据库名称4. 2> go5. 1> select *from 表名6. 2> go
- mysql服务命令行操作
启动 net start mysql 关闭 net stop mysql 登陆 mysql -hlocalhost -uusername -ppassword 退出 exit 显示数据库 show d ...
- ES6面试 知识点汇总(全)
近期在复习ES6,针对ES6新的知识点,以问答形式整理一个全面知识和问题汇总.(全干货,适合对ES6有一定理解的同学复习,以及ES6面试.) 一.问:ES6是什么? 答: ES6是新一代的JS语言标准 ...
- leetcode-399-除法求值
方法一:dfs+图 class Solution: def calcEquation(self, equations: List[List[str]], values: List[float], qu ...