Академический Документы
Профессиональный Документы
Культура Документы
In an effort to standardise user environments across all EMSE Solaris servers, we are
migrating all users to use the Korn shell (ksh). This is a little different to the shell currently
used by most of you - the C shell (csh). Lots of work has gone on behind the scenes to
ensure a standard environment and to make sure all applications will continue to work when
we change your shell.
This document is a very quick guide on how to use key features of the Korn shell and includes
instructions on how to migrate your existing aliases and environment variables along with a
list of common csh commands and their ksh equivalents. It is far from comprehensive and
anyone requiring further information should refer to the documents at:
http://www.kornshell.com/doc/ or view the ksh manual on your Solaris system by typing man
ksh at the shell prompt.
Aliases
Although we have provided a standard set of system-wide aliases in ksh, any aliases you
have defined yourself probably in .cshrc in your home directory will have to be migrated
by you.
To do this, youll need to create a .kshrc file in your home directory using an editor such as vi.
The syntax for aliases is similar to that in csh, for example, an alias for X in your .cshrc file:
alias X 'xrdb .Xdefaults &'
would need to be changed to:
alias -x X='xrdb .Xdefaults &'
in your .kshrc file
You will need to logout and log back in for these to take effect.
If this doesnt work then you may need to add the following to the .profile file in your home
directory to tell ksh where to find your aliases:
ENV=${HOME}/.kshrc
export ENV
Environment variables
If you have any environment variables set in your .login and .cshrc files youll need to transfer
these to ksh, placing them in either your .profile or .kshrc file. The syntax is a little different, for
example in C shell:
setenv PATH "/bin:/usr/bin:/usr/sbin:ucb/bin"
would become:
export PATH=/bin:/usr/bin:/usr/sbin:ucb/bin
in Korn shell.
Csh
!!
History
ksh
r <return>
history
!n
r n <return>
<esc>
(filec needs to be set
for this to work)
<esc>*
(no setup is
required in ksh)
Essential vi commands
Command
k
j
l
h
cw
x
X
i
a
Function
Scroll back through the command history
Scroll forward through the command history
Move right along the current command
Move left along the current command
Change the current word
Delete the character to the right
Delete the character to the left
Insert characters (youll need to press the escape key again to enter edit mode)
Append characters to the end of the command
Other changes
Weve also standardised the prompt. Instead of % , you will now get a shell prompt in the
following format:
[username@hostname current_directory] $