Korn shell 是一个unix上的shell 程序,主要用在各种unix系统上,比如:sun/oracle unix,AIX等。ksh是有贝尔实验室的David korn开发出来的,ksh结合了C shell的交互式特性,并且也融入了bourne shell的语法。
安装korn shell(ksh)
在linux终端下,通过yum来安装ksh程序
$sudo yum install ksh
或
#yum install ksh
命令输出:
Loaded plugins: fastestmirror Determining fastest mirrors * base: ftp.nsysu.edu.tw * extras: ftp.cs.pu.edu.tw * updates: mirrors.stuhome.net base | 3.7 kB 00:00 extras | 3.4 kB 00:00 updates | 3.4 kB 00:00 updates/primary_db | 3.9 MB 00:05 Setting up Install Process Resolving Dependencies --> Running transaction check ---> Package ksh.x86_64 0:20100621-19.el6_4.4 will be installed --> Finished Dependency Resolution Dependencies Resolved ============================================================================================ Package Arch Version Repository Size ============================================================================================ Installing: ksh x86_64 20100621-19.el6_4.4 updates 687 k Transaction Summary ============================================================================================ Install 1 Package(s) Total download size: 687 k Installed size: 1.5 M Is this ok [y/N]: Downloading Packages: ksh-20100621-19.el6_4.4.x86_64.rpm | 687 kB 00:00 Running rpm_check_debug Running Transaction Test Transaction Test Succeeded Running Transaction Installing : ksh-20100621-19.el6_4.4.x86_64 1/1 Verifying : ksh-20100621-19.el6_4.4.x86_64 1/1 Installed: ksh.x86_64 0:20100621-19.el6_4.4 Complete!
查看ksh的安装路径,输入下面的命令:
$whereis ksh 或者使用grep命令: $grep --color ksh /etc/shells
命令输出:
将ksh设置为系统默认shell
超级用户(root)可以使用下面的命令为任何用户更改登陆后的shell程序。
命令如下:
$sudo chsh -s /bin/ksh 用户名 或者 #chsh -s /bin/ksh 用户名
验证当前用户正在使用的shell程序,输入下面的命令:
$echo $SHELL
查看ksh的版本号,输入命令:
$ksh --version