Make your own free website on Tripod.com
MONKEY LINUX
current version 06              @(õ õ)@
released 9/5/1997                 (Y)                 [ ALIASING TUTORIAL ]
---------------------------------------------------------------------------
[ Home ]        [ Description ]    [ Programs ]     [ System Requirements ]
[ Download ]    [ Installation ]   [ Tutorials ]    [ Links ]
---------------------------------------------------------------------------
     Aliases are shortcut commands that are specific to each shell (bash
and tcsh).  For instance, it would be much simpler and more intuitive if
you could access the floppy device by simply typing 'floppy' at the
command prompt instead of typing that long drawn out 'mount' command.  In
this example, 'floppy' would be an alias for 'mount -t msdos /dev/fd0
/mnt -o rw'.  We could even create a shortcut command for 'umount /mnt'
by assigning it the alias 'ufloppy'.

     ALIASING IN TCSH.  The enhanced C shell, or TCSH, is the default
shell in Monkey.  Its user defined aliases are contained within the
~/.cshrc file, where ~ refers to the home directory of root or any other
user whom you are logged in as.  After initially logging in as root, the
super user, you're brought to the Monkey prompt.  Type the following
sequence of commands to take a look at the ~/.cshrc file:

     cd ~			 CHANGE TO HOME DIRECTORY
     ls -a			 LIST CONTENTS
     cat .cshrc | more	         VIEW CONTENTS OF .cshrc FILE
     alias ll 'ls -l'
     alias la 'ls -la'
     alias cl 'cd \!* ; ls -l'
     alias m   less

     Notice that Monkey's developer(s) included a few useful aliases.  We
want to add our floppy device aliases to that list.  Here's how to do it
in the JOE 2.2 text editor:

     1. Open the .cshrc file in the JOE 2.2 text editor.
          joe ~/.cshrc
     2. Press Ctrl+K then H for the help screen.
     3. Add these lines to the document exactly as shown.
          alias floppy 'mount -t msdos /dev/fd0 /mnt -o rw'
          alias ufloppy 'umount /mnt'
     4. Press Ctrl+K then X to save changes and exit joe.

     From now on, while using the TCSH, you can access the floppy device
by typing 'floppy' and tell Monkey that you're finished using it by
typing 'ufloppy'.  Isn't life grand!

     ALIASING IN BASH.  The BASH shell, or Bourne Again Shell, was
GNU/Linux's first shell.  It's a clone of the Bourne Shell, or SH,
designed for another operating system called UNIX.  Follow these steps to
enter BASH and define our floppy device aliases:

     1. Change to the BASH shell.
          bash
     2. Create the alias for mounting the floppy.
          alias floppy='mount -t msdos /dev/fd0 /mnt -o rw'
     3. Create the alias for unmounting the floppy.
          alias ufloppy='umount /floppy'
     4. Take a look at our new aliases.
          alias
          alias floppy='mount -t msdos /dev/fd0 /mnt -o rw'
          alias ufloppy='umount /mnt'
     5. Type 'exit' to return to the TCSH shell.

     If you should ever grow tired of your BASH shell aliases then you
can delete them by issuing the 'unalias [alias name]' command.

     Some pointers on aliasing.  Give your aliases unique names.  For
example, it might make sense to alias CD-ROM access with the name 'cdrom'
but there's a device that goes by that name (/dev/cdrom).  Therefore,
we need to give it a different name like 'disc.'

                                                                    [ top ]
---------------------------------------------------------------------------
Send webmaster an email.               [ Disclaimer ] [ Legal ] [ Updates ]
---------------------------------------------------------------------------
Copyright (C) 2001, 2002 August Chaco