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在里头--在博客园显示效果挺 ...
随机推荐
- 拾遗:vim 快捷键设置
~/.vimrc 零.批量注释与反注释 :sp / :vsp 横向 / 纵向拆分窗口 :e 打开新文件 zc:拆叠代码 / zo:展开代码 set foldmetho ...
- 前端(十二)—— JavaScript基础操作:if语句、for循环、while循环、for...in、for...of、异常处理、函数、事件、JS选择器、JS操作页面样式
JavaScript基础操作 一.分支结构 1.if语句 if 基础语法 if (条件表达式) { 代码块; } // 当条件表达式结果为true,会执行代码块:反之不执行 // 条件表达式可以为普通 ...
- yield迭代器的使用
class Program { static void Main(string[] args) { List<Student> students = new List<Student ...
- NIO 源码分析(02-1) BIO 源码分析
目录 一.BIO 最简使用姿势 二.ServerSocket 源码分析 2.1 相关类图 2.2 主要属性 2.3 构造函数 2.4 bind 方法 2.5 accept 方法 2.6 总结 NIO ...
- linux安装lolcat实现彩色文字输出信息
[root@localhost ~]# mount /dev/sr0 /media/[root@localhost ~]# rpm -ivh epel-release-latest-7.noarch. ...
- 随笔记录 误删boot恢复 2019.8.7
系统还原: 1. 2. 3. 4. 5.进入硬盘 6.挂载光盘,安装恢复boot 7.安装grub2 8.重建grub.cfg文件
- Dijkstra算法举例分析
题目如下: 如上图,设A为源点,求A到其他各顶点(B.C.D.E.F)的最短路径.线上所标注为相邻线段之间的距离,即权值.(注:此图为随意所画,其相邻顶点间的距离与图中的目视长度不能一 一对等). 解 ...
- <el-table>序号逐次增加,翻页时继续累加,解决翻页时从编号1开始的情况
注释: scope.$index 当前序号 cuePage 表示当前页码 pageSize 表示每页显示的条数
- Spring常见面试题及答案解析
.说一下spring中Bean的作用域 singleton: Spring IoC容器中只会存在一个共享的Bean实例,无论有多少个Bean引用它,始终指向同一对象.Singleton作用域是Spri ...
- vue-cli搭建vue开发环境
前置环境 npm install -g vue-cli vue list 已安装环境后: vue init webpack sell 建立项目名称sell----------------------- ...