系统提示信息
Bash shell的登录信息提示在【/etc/issue】和【/etc/motd】中配置。
【/etc/issue】文件可以修改系统提示信息,例如系统版本、时间等
【/etc/motd】文件可以修改用户登陆时候的提示信息,例如欢迎信息等。
修改/etc/issue文件影响第一行
修改/etc/motd文件影响第二行
系统设定值
Bash shell系统设定值在【/etc/profile】和【/etc/bashrc】中进行设置。而个人设定值在【~/.bash_profile】和【~/.bashrc】中设置。
个人设定值
Bash shell个人设定值在【~/.bash_profile】和【~/.bashrc】中设置。
在上面的4个文件中分别加上标示。
login as: root [email protected]'s password: Server refused to set environment variables Last login: Thu Aug 16 22:13:38 2012 this is /etc/profile this is /etc/bashrc this is ~/.bashrc this is ~/.bash_profile [root@jianshi-21 ~]#
用户登录系统时配置文件的加载顺序:
1 /etc/profile
2 /etc/bashrc
3 ~/.bashrc
4 ~/.bash_profile
[root@jianshi-21 ~]# source .bashrc this is /etc/bashrc this is ~/.bashrc [root@jianshi-21 ~]#
[root@jianshi-21 ~]# . .bashrc this is /etc/bashrc this is ~/.bashrc [root@jianshi-21 ~]#
终端环境设置
终端的环境设置使用【stty】命令,通过stty命令可以直接修改和查询终端驱动程序的设置。stty命令的使用比较简单,可以不带参数执行。
【stty -a】命令将当前所有的stty参数全部显示出来。
[root@jianshi-21 ~]# stty -a speed 38400 baud; rows 24; columns 80; line = 0; intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D; eol = <undef>; eol2 = <undef>; start = ^Q; stop = ^S; susp = ^Z; rprnt = ^R; werase = ^W; lnext = ^V; flush = ^O; min = 1; time = 0; -parenb -parodd cs8 -hupcl -cstopb cread -clocal -crtscts -ignbrk -brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr icrnl ixon -ixoff -iuclc -ixany -imaxbel opost -olcuc -ocrnl onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0 ff0 isig icanon iexten echo echoe echok -echonl -noflsh -xcase -tostop -echoprt echoctl echoke [root@jianshi-21 ~]#
有时候运行一些程序,需要修改终端的设置。对于用户而言,这些修改往往是不可见的,因为程序在退出后,会将终端设置为原有的情况。但是,如果出现程序崩溃或被kill命令杀死的情况,有可能来不及将终端设置为原有的参数。这时,终端就有可能出现异常的情况,有可能不能正常处理换行字符,或不能恰当地显示输入的字符,甚至可能不能正确执行命令。
使用cat命令或more命令去显示一个二进制文件也有可能会造成终端的混乱。下图为所示为使用了cat命令显示一个名为a.out的二进制文件的情况。显示完文件内容后,出现了终端的混乱。这时,所有输入和输出字符都无法正常显示。出现这种情况的原因是由于很多的二进制文件都包含有特殊的字符,这些字符会导致终端混乱这一问题的出现。
在这种情况下,可以使用reset命令将终端恢复到正确的状态。
修改del向后删除,backspace向前删除
Sty erase ^? Stty erase ^H