CentOS PS1 设置

Default:

in /etc/bashrc

PS1="[\[email protected]\h \W]\\$ "

Description:

  • \a : an ASCII bell character (07)
  • \d : the date in "Weekday Month Date" format (e.g., "Tue May 26")
  • \D{format} : the format is passed to strftime(3) and the result is inserted into the prompt string; an empty format results in a locale-specific time representation. The braces are required
  • \e : an ASCII escape character (033)
  • \h : the hostname up to the first ‘.‘
  • \H : the hostname
  • \j : the number of jobs currently managed by the shell
  • \l : the basename of the shell’s terminal device name
  • \n : newline
  • \r : carriage return
  • \s : the name of the shell, the basename of $0 (the portion following the final slash)
  • \t : the current time in 24-hour HH:MM:SS format
  • \T : the current time in 12-hour HH:MM:SS format
  • \@ : the current time in 12-hour am/pm format
  • \A : the current time in 24-hour HH:MM format
  • \u : the username of the current user
  • \v : the version of bash (e.g., 2.00)
  • \V : the release of bash, version + patch level (e.g., 2.00.0)
  • \w : the current working directory, with $HOME abbreviated with a tilde
  • \W : the basename of the current working directory, with $HOME abbreviated with a tilde
  • \! : the history number of this command
  • \# : the command number of this command
  • \$ : if the effective UID is 0, a #, otherwise a $
  • \nnn : the character corresponding to the octal number nnn
  • \\ : a backslash
  • \[ : begin a sequence of non-printing characters, which could be used to embed a terminal control sequence into the prompt
  • \] : end a sequence of non-printing characters

Define By Self:

/etc/profile.d/prompt.sh

#!/bin/bash

if [ $(id -u) -eq 0 ];then

PS1="[my-local-test \[email protected]\h:\W]# "

else

PS1="[my-local-test \[email protected]\h:\W]$ "

fi

时间: 2024-07-30 22:59:22

CentOS PS1 设置的相关文章

CentOS - 语系设置成为中文

[[email protected] /]# vim /etc/sysconfig/i18n   1 LANG="en_US.UTF-8"   2 SYSFONT="latarcyrheb-sun16" 将LANG="en_US.UTF-8" 换成 LANG="zh_CN.UTF-8" 编辑保存wq即可,重启系统,所有操作用root. CentOS - 语系设置成为中文,布布扣,bubuko.com

centos 分辨率设置

最近又实验安装了centos 5.8,装完后启动,界面太差了,看着费劲. 百度一查,原来是分辨率的问题.下面是分辨率设置方法. "系统->管理->显示"(英文版本的是system->adminstaration->display),打开后,hardware的monitor type 选择你的显示器对应类型,我的是LCD 1440x900. video card 显卡驱动,默认的都是用的linux通用的显卡驱动vesa,我看了一下列举的驱动,刚好有我的显卡驱动(英

centos上设置时区

本地单文件上传脚本,命名uf 这是在本机上做的测试,利用bpcs_uploader脚本实现,只是进行简单的封装,自动完善云端文件路径. 技术要点:使用dirname获取文件所在目录,使用pwd获取文件完整路径,并作为云端文件路径. #!/bin/bash cur_dir=$(cd "$(dirname "$1")"; pwd) name=$(basename "$1") /home/grm/bin/bpcs_uploader/bpcs_uploa

VMware于CentOS网络设置

VMware于CentOS网络设置 底: 笔记本电脑有两块网卡: 1. 网卡连接公司内网,仅仅配置了内网ip和子网掩码. 2. 无线网卡.连接4g无线路由器.dhcp自己主动配置. 问题: 在VMware中安装了CentOS5.6之后,CentOS不能连接外网. 解决方式: 1. VMware中选中CentOS,右键虚拟机设置,选择网络适配器,选择桥接模式,勾选复制物理网络连接状态. 2. VMware左上角菜单选择编辑->虚拟网络编辑器,选中VMnet0,以下的VMnet信息.勾选桥接模式,然

学习鸟哥私房菜--linux bash 的环境变量ps1设置

bash里边的变量ps1是用户平时的提示符,系统默认为[[email protected] 工作目录]$.关于ps1的相关介绍详见:http://www.cnblogs.com/starspace/archive/2009/02/21/1395382.html 文章里边介绍了要想ps1的修改在重启有效需要将它写入~/.bash_profile中,但是这是针对login shell的(即各种tty终端界面等),对于进入xwindow启动的命令行终端这样的nonlogin shell就不管用了,这是

Centos如何设置IP地址,LINUX怎么修改IP地址

Centos如何设置IP地址,LINUX怎么修改IP地址 1 2 3 4 5 6 7 分步阅读 百度经验:jingyan.baidu.com 对于很多刚刚接触linux的朋友来说,如何设置linux系统的IP地址,作为第一步,下面小编以centos系统为例,给大家演示如何给centos设置IP地址,如何修改linux 系统IP地址? 步骤阅读 百度经验:jingyan.baidu.com 工具/原料 linux系统,centos 百度经验:jingyan.baidu.com 查看IP地址 1 登

VMware中CentOS网络设置

VMware中CentOS网络设置 背景: 笔记本电脑有两块网卡: 1. 有线网卡连接公司内网,只配置了内网ip和子网掩码: 2. 无线网卡,连接4g无线路由器,dhcp自动配置. 问题: 在VMware中安装了CentOS5.6之后,CentOS不能连接外网. 解决方案: 1. VMware中选中CentOS,右键虚拟机设置,选择网络适配器,选择桥接模式,勾选复制物理网络连接状态: 2. VMware左上角菜单选择编辑->虚拟网络编辑器,选中VMnet0,下面的VMnet信息,勾选桥接模式,然

CentOS 网络设置修改 指定IP地址 DNS 网关(转)

CentOS 网络设置修改 指定IP地址 DNS 网关(实测 笔记) 环境: 系统硬件:vmware vsphere (CPU:2*4核,内存2G) 系统版本:Centos-6.5-x86_64 路由器网关:192.168.1.1 步骤: 1.查看网络MAC地址 [[email protected] ~]# cat /etc/udev/rules.d/70-persistent-net.rules 显示如下信息 # PCI device 0x15ad:0x07b0 (vmxnet3) SUBSY

centos无线网卡设置

联想thinkpad E430 ,安装上centos后,无线网卡一直无法使用,经历了艰苦曲折到网卡驱动安装过程,历时2个晚上终于开心到用上无线网卡. 1.查看无线网卡到具体型号 [[email protected] local]# lspci 09:00.0 Network controller: Realtek Semiconductor Co., Ltd. RTL8188CE 802.11b/g/n WiFi Adapter (rev 01) 可见对应的驱动为:RTL8188CE 或者 [[