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在里头--在博客园显示效果挺 ...
随机推荐
- 剑指offer——38二叉搜索树与双向链表
题目描述 输入一棵二叉搜索树,将该二叉搜索树转换成一个排序的双向链表.要求不能创建任何新的结点,只能调整树中结点指针的指向. 题解: 在搜索二义树中,左子节点的值总是小于父节点的值,右子节点的值总 ...
- Pandas异常值处理
import pandas as pd #生成异常数据 df=pd.DataFrame({'col1':[1,120,3,5,2,12,13], 'col2':[12,17,31,53,22,32,4 ...
- ES7/ES8 语法学习
作为一个前端开发者,感觉需要学习的东西贼多,ES6刚学会用没多久,又得学习了解ES7/ES8新增的东西,这里是看了大佬们文章的一点点总结以及摘抄的内容,给自己当笔记使用 内容转载自:https://w ...
- 使用fastClick.js所产生的一些问题
开发h5活动页时想到移动端会有300ms的延迟,于是便打算用fastClick.js解决. 页面引入fastClick.js后,滑动H5页面的时候发现谷歌浏览器会报错,如下: Unable to pr ...
- Linux网络编程 了解
IPV4 -- IP地址分类:主机号是区分主机的,网络号是区分网段的 子网掩码是对主机号进行划分子网用的 举例说明: 对 192.168.1.0网段划分4个 其子网掩码 : 拿出主机号的两个位进行划分 ...
- python pathlib模块详解
python pathlib模块详解
- Mycat搭建负载均衡,读写分离的Mysql集群
Mycat搭建负载均衡,读写分离的Mysql集群 准备环境 1.mysql-5.7.24-linux-glibc2.12-x86_64.tar.gz 2.Mycat-server-1.6.7.4-te ...
- MVC升级后报"当前上下文中不存在ViewBag"错的解决方法
- Bootstrap4入门
基础样式 颜色 文字颜色以.text-*开头 背景颜色.bg-* primary / seconday / success / danger / warning / info / muted / wh ...
- JavaScript做个时间表 Date()
<span id="shiji"></span><script> window.setInterval("time()",5 ...