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在里头--在博客园显示效果挺 ...
随机推荐
- hdu6354 /// 圆的相交
题目大意: 给定m r 初始圆盘以原点为圆心半径为r 给定m个圆的圆心(x,y) 半径r 保证m个圆互不相交且不会覆盖圆盘 用这m个圆来切割初始的圆盘求最后圆盘外围的长度 求圆与圆盘的交点 减去圆盘上 ...
- hdu6315 /// 线段树区间更新
题目大意: 给定n q 为序列的个数和操作的个数 给定n个数的序列b[]作为分母 初始全为0的序列a[]作为分子 两种操作 add l r 为a[]的l到r区间全部+1 query l r 为查询l到 ...
- YApi导入swagger生成的接口
1.swagger的JSON地址,net或netcore开发环境下 2.配置在内网中,localhost请用对应的IP地址替换,在浏览器地址栏中输入以上地址,会返回一个json格式的文档 3.导入 4 ...
- 微信小程序のwxs
WXS(WeiXin Script)是小程序的一套脚本语言,结合 WXML,可以构建出页面的结构. wxs可以说就是为了满足能在页面中使用js存在的,在wxml页面中,只能在插值{{ }}中写简单的j ...
- 转载:vs2010 问题 >LINK : fatal error LNK1123: 转换到 COFF 期间失败: 文件无效或损坏
原文链接:http://www.cnblogs.com/newpanderking/articles/3372969.html >LINK : fatal error LNK1123: 转换到 ...
- md详解和rd详解:一次性创建多个目录和多级子目录
md 命令: 官方解释: E:\ABC>md /? 创建目录. MKDIR [drive:]path MD [drive:]path 如果命令扩展被启用,MKDIR 会如下改变: 如果需要,MK ...
- log4cplus TimeBasedRollingFileAppender
参考自:http://blog.csdn.net/u010607621/article/details/54944696 对于TimeBasedRollingFileAppender 这个日志appe ...
- wordpress Warning: Parameter 2 to qtranxf_postsFilter() expected to be a reference
wordpress qtranslate-x Warning: Parameter 2 to qtranxf_postsFilter() expected to be a reference Para ...
- CTF学习路线指南(附刷题练习网址)
PWN,Reverse:偏重对汇编,逆向的理解: Gypto:偏重对数学,算法的深入学习: Web:偏重对技巧沉淀,快速搜索能力的挑战: Mic:则更为复杂,所有与计算机安全挑战有关的都算在其中 常规 ...
- leetcode-132-分割回文串②*
题目描述: 方法一:动态规划 class Solution: def minCut(self, s: str) -> int: min_s = list(range(len(s))) n = l ...