How to modify the default shell in Solaris

Source: Internet
Author: User
Tags command line modify save file root directory linux

Solaris has a lot to do with this is not the same as it used to be, the following are some of the problems and solutions for the shell in Solaris.

The default shell of Solaris is SH, which is the command-line prompt identifier (root user): #

In the Linux command line, the user name, the host name, and the current path name are the names of the prompts. This can give people a clear feeling. But the general default shell of Linux is bash, not sh. If you only want to switch the shell in the current use, the method is simple enough to enter at the command line:

$ bash

bash-3.00$ CSH

david% SH

$

If you want to permanently change the default shell, you need to modify the/etc/passwd file. With passwd Open, the first line records information about the root user, and the line reads:

Root:x:0:0:super-user:/:/sbin/sh

Where, after the last colon, the default shell of the root user, we modify it to the path of bash:

Root:x:0:0:super-user:/:/usr/bin/bash

Of course, we can also use stty life to modify, specific reference blog:

Stty command

Http://blog.csdn.net/tianlesoftware/archive/2010/03/15/5381984.aspx

Description of Shell and shell Script:

The DOS Command.com is a shell that is responsible for interpreting your instructions and executing it. Similarly, this is also on UNIX, which was automatically initiated by the system after you successfully login.

There are many kinds of shell,sh, CSH, Ksh, tcsh, bash, etc. on UNIX, which are generally changed with csh,login command, but you must first know the new shell you want to change in that directory. TCSH has functions similar to DOSKEY.

There are so-called batch files in DOS to facilitate the handling of routine work. UNIX also has batch processing, it is called Shell Script, and is much stronger than DOS batch file, writing is almost a high-level language. Shell script is a text file, but its status is identical to other commands or executables, as long as the shell script access is set to executable with the chmod instruction. The. login file in the $home directory is a typical Shell Script, a DOS-like Autoexec.bat.

Save file passwd, exit.

In this way, you can use the TAB key to complete the command line input and up and down arrows to achieve the history of the input command playback, and SH does not have such a function. However, this modification alone does not implement a command line prompt that appears as both a user name and a host name and the current pathname in the Linux prompt.

See more highlights of this column: http://www.bianceng.cnhttp://www.bianceng.cn/OS/unix/

You need to edit the file separately. That is, create a new file under $home. Profile, if the file exists, add content inside it. Because it is root, the $home path is the root directory/. Create a new file in the root directory. Profile, and add the following:

Ps1= ' [/u@/h: $PWD]# '

Export PS1

Save exit the file and restart the system. After entering the system, open a terminal, the command line prompt is:

[root@solaris:/]#

To execute a command:

[root@solaris:/] #echo $SHELL//View the system default SHELL

/usr/bin/bash

To execute a command:

[root@solaris:/] #cd Home

The command line changes to:

[root@solaris:/home]#

Where Root refers to the username, Solaris is the hostname and/home is the current path.

Of course, if you are accustomed to using CSH, you can switch the shell to CSH first. You can then enter a command:

#set Filec

This allows the command line completion to be implemented under CSH. However, the fill input uses not the TAB key, but the ESC key

When we're writing a shell script, we have to add the first line to the "#! /bin/ksh ". This is to indicate which program to use to execute the line in the script.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.