Useful Aliases

Here are some useful aliases to make your life easier...

alias l   '/bin/ls -F'           # Show file-types
alias la  '/bin/ls -aF  | more'  # Show all files
alias ll  '/bin/ls -lF  | more'  # Show files, long listing
alias lla '/bin/ls -laF | more'  # Show all files, long listing
alias rm  '/usr/bin/rm -ir'      # safe remove (interactive,recurcive)

To make these work every time, you need to insert them in one
of the csh shell initialization files. Your CS account
was issued with three such files: .cshrc, .aliases.interactive,
and .aliases.x (this is non-standard, check your CAFE account). 
The appropriate one for the above is your  .aliases.interactive .

This file already contains some similar aliases, so let's clean 
it up first:

0. Edit your  .aliases.interactive  file:
	vi .aliases.interactive
   and delete the lines for alias c , open , shut , x , ls , la

Now you need to insert the above aliases in there.
It can be done in various ways:

1.By hand, the hard, error-prone way (not recommended!):
  Type them in, exactly as shown, no errors allowed!
  See item 4. below, for how to activate them for now.

2.Using the mouse:
  Move mouse to the Netscape where you are reading this message,
  press the LEFT button at the beginning of the 1st "alias" word,
  and drag it southwest to the end of the last word ("remove").  
  Everything in between should chance color, indicating the mouse 
  picked it up (copied it into its buffer).  Release the button. 
  Now move mouse to the xterm where you are editing the 
   .aliases.interactive  file, open a new line: o, 
  and click MIDDLE mouse button; the buffer gets dumped; 
  See item 4. below, for how to activate them for now.

3.The sophisticated way!  (recommended)
  A bit more complicated, but you'll learn some useful operations!
  Save this web page into a file as Text file:  aliases.txt
  Move mouse to an xterm and 
	cp aliases.txt aliases 	(make a copy to mess with)
	vi aliases
  We want to delete every line except the lines with the aliases.
  Can be done with dd, but there are too many lines...
  Here is a faster way:
  Move CURSOR to the first "--------------------" line.
	:1,.d	[delete lines 1 to current(.)]
  Move cursor to the next  "--------------------" line.
	:.,$d	[delete lines . to last($)]
  Now we want to insert this stripped aliases file
  into the .aliases.interactive file. It's easy:
  Move mouse to the xterm where you're VIing .aliases.interactive,
  create blank line: o ESC and do:
	:r aliases	("read" file "aliases")

By the way, you just learned and practiced a bit more of VI:
        How to delete lots of lines by line numbers:
		:L1,L2d      [delete lines L1 to L2]
		:.,.+20d     [delete current and 20 lines below it]
        How to "read" (insert) a file into the file being edited:
		:r file
Very useful stuff !

4.In all cases: To activate the new aliases, do:
	 source .aliases.interactive 
  They will work in the xterm where you sourced.  
  Next time you login, they'll work in every xterm.

5. Here are some more very convenient aliases that should be inserted in your .aliases.x file. -------------------------------- alias c 'echo " ";set old=$cwd; chdir \!* ;echo $cwd;chtb;ls -F' alias b 'echo " ";set ba=$old;set old=$cwd;chdir $ba; unset ba; \ echo $cwd; chtb; ls -F' alias bb 'echo " ";set old=$cwd;chdir .. ;echo $cwd ;chtb;ls -F' set old=$cwd -------------------------------- I strongly suggest you use the "sophisticated" method ( item 3. ) to insert them into your .aliases.x file. Here is what these do: Typing: c dir ("dir" is any dir name) does the following: prints a blank line (echo " ") saves the current directory name in a shell variable ("old") changes directory into "dir" (\!* is replaced by "dir") prints the full path to "dir" (echo $cwd) shows "dir" in the title bar of the xterm (chtb is another alias) and also "ls -F" (lists the files in "dir") ! All with the single "c" !!! This is the power of shell aliases! Typing b takes you back to the directory you were before ! Typing bb takes you to the parent directory (fancy cd ..) Try them out (and watch the paths, and the title bar): c /usr/local b b bb c Soooo, from now on use: c , b , bb to move around, and l , ll , la , lla to list your files. I suggest you also install them on your CAFE account (and on any other unix account you have!). They can all go into your .cshrc (if using csh), or your .zshrc (if using zsh). Enjoy !