Modify and set the default shell in Solaris10
2014-02-28 15:07
489 查看
安装完毕系统后,Solaris的默认Shell是sh,即命令行提示符为(本文中所讲的都是root用户,其他权限的用户也是同样的方法):#
而在用Linux命令行的提示符中既有用户名,还有主机名称以及当前路径的名称。这样可以给人一目了然的感觉。不过Linux下一般默认Shell是bash,而不是sh。如果只想在当前的使用中切换Shell的话,方法很简单,可以在命令行中输入:
#bash
//切换至bash
或者
#csh //切换至csh
如果需要永久性的改变默认的shell,则需要修改/etc/passwd文件。打开passwd,第一行记录的是root用户的相关信息,该行内容为:
root:x:0:0:Super-User:/:/sbin/sh
其中,最后一个冒号后面即为root用户的默认shell,我们将其修改为bash的路径:
root:x:0:0:Super-User:/:/usr/bin/bash
保存文件passwd,退出。
这样,就可以实现用Tab键补全命令行的输入和上下箭头实现输入命令的历史回放,而sh却没有这样的功能。但是,仅仅这一点修改,并不能实现命令行提示符中出现象Linux提示符中既有用户名,又有主机名和当前路径名。
需要另外编辑文件。即在$HOME下新建文件.profile,如果文件存在的话就在里面添加内容。由于是root用户,所以$HOME的路径为根目录/。在根目录下新建文件.profile,并在其中添加如下内容:
PS1='[\u@\h:$PWD]#'
export PS1
保存退出该文件,并重启系统。进入系统后,打开一个终端,则命令行提示符为:
[root@solaris:/]#
执行命令:
[root@solaris:/]#echo $SHELL //查看系统默认的shell
/usr/bin/bash
执行命令:
[root@solaris:/]#cd home
则命令行变为:
[root@solaris:/home]#
其中,root是指用户名,solaris是主机名,/home为当前路径。
当然,如果习惯使用csh,可以先将shell切换至csh。然后可以输入命令:
#set filec
这样,可以在csh下实现命令行补全。不过,补全输入使用的不是Tab键,而是ESC键
==================================================================================
sh是bourne shell, bash是bourne again shell
bash的功能强大得多,拥有一些bourne shell没有的csh和ksh的特性
查看shell版本
#echo $0
更改shell版本
#bash
\\bash shell
#csh \\cshshell
#ksh \\kshshell
本文转载自Network的博客:http://blog.sina.com.cn/s/blog_49f8dc400100bqqb.html
而在用Linux命令行的提示符中既有用户名,还有主机名称以及当前路径的名称。这样可以给人一目了然的感觉。不过Linux下一般默认Shell是bash,而不是sh。如果只想在当前的使用中切换Shell的话,方法很简单,可以在命令行中输入:
#bash
//切换至bash
或者
#csh //切换至csh
如果需要永久性的改变默认的shell,则需要修改/etc/passwd文件。打开passwd,第一行记录的是root用户的相关信息,该行内容为:
root:x:0:0:Super-User:/:/sbin/sh
其中,最后一个冒号后面即为root用户的默认shell,我们将其修改为bash的路径:
root:x:0:0:Super-User:/:/usr/bin/bash
保存文件passwd,退出。
这样,就可以实现用Tab键补全命令行的输入和上下箭头实现输入命令的历史回放,而sh却没有这样的功能。但是,仅仅这一点修改,并不能实现命令行提示符中出现象Linux提示符中既有用户名,又有主机名和当前路径名。
需要另外编辑文件。即在$HOME下新建文件.profile,如果文件存在的话就在里面添加内容。由于是root用户,所以$HOME的路径为根目录/。在根目录下新建文件.profile,并在其中添加如下内容:
PS1='[\u@\h:$PWD]#'
export PS1
保存退出该文件,并重启系统。进入系统后,打开一个终端,则命令行提示符为:
[root@solaris:/]#
执行命令:
[root@solaris:/]#echo $SHELL //查看系统默认的shell
/usr/bin/bash
执行命令:
[root@solaris:/]#cd home
则命令行变为:
[root@solaris:/home]#
其中,root是指用户名,solaris是主机名,/home为当前路径。
当然,如果习惯使用csh,可以先将shell切换至csh。然后可以输入命令:
#set filec
这样,可以在csh下实现命令行补全。不过,补全输入使用的不是Tab键,而是ESC键
==================================================================================
sh是bourne shell, bash是bourne again shell
bash的功能强大得多,拥有一些bourne shell没有的csh和ksh的特性
查看shell版本
#echo $0
更改shell版本
#bash
\\bash shell
#csh \\cshshell
#ksh \\kshshell
本文转载自Network的博客:http://blog.sina.com.cn/s/blog_49f8dc400100bqqb.html
相关文章推荐
- Get the file name and extension in Shell
- Create and Use a Custom Formatter in the Apache HBase Shell
- ORM中的对象间关联及其默认事务需要 - The Object Associations And The Default Transaction Requirements In ORM
- Default Bearer and Dedicated Bearer in the LTE
- How to set the DefaultButton in a Page Based on ASP.NET Master Page
- Solaris vs. Linux: Ecosystem-based Approach and Framework for the Comparison in Large Enterprise
- The Default Methods And Static Methods In Java Interface
- ORM中的对象间关联及其默认事务需要 - The Object Associations And The Default Transaction Requirements In ORM
- What exactly is copy-on-modify semantics in R, and where is the canonical source?
- Implementing the Repository and Unit of Work Patterns in an ASP.NET MVC Application (9 of 10)
- Solaris 10 Advance Administrator 310-202 读书笔记 第八章 ---- Describing RAID and the Solaris™ Volume Manager Software
- Solaris vs. Linux: Ecosystem-based Approach and Framework for the Comparison in Large Enterprise
- [Warning] '--default-character-set' is deprecated and will be removed in a future release
- OpenOffice.org Code Snippets--Get and modify the current selection in calc (in C++)
- Step by Step Installation of the Subversion 1.x Server for Linux and Solaris 8/9/10 (English)
- 10 Tips to Survive and Progress in the Field of Software Testing
- Programming in Objective-C 学习笔记10——Cocoa, Cocoa Touch and the iOS SDK
- How to copy and paste quickly in the shell
- Modify in the AVL report,and refresh to the internal table
- How to fix the issue that GEM_HOME and/or GEM_PATH not set issue for rvm in mac version 10.12