Shortcuts

This section looks at some more useful shortcuts that are available to users of the Korn Shell.

Home Directory

Instead of having to type in the full path of a user's home directory, you can just type a tilde (~) character followed by the user's login name:

$ cd ~jgreen
$ pwd
/export/home/jgreen
$

Previous Directory

The Korn Shell remembers which directory you where last in so you can move to it without needing to type it in. Just type “cd -”:

$ pwd
/really/long/pathname/that/I/can/never/remember
$ cd /tmp
$ pwd
/tmp
$ cd -
$ pwd
/really/long/pathname/that/I/can/never/remember
$

Aliases

The Korn Shell allows you to create shortcuts to commands. For example, the following will create an alias called ll which will run an ls -l.

 $ ...

Get Solaris™ Operating Environment Boot Camp now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.