UNIX Productivity Hints

The following keystrokes are widely available in UNIX programs. All are supported by Emacs; subsets are supported by tcsh, Netscape, MATLAB, IDL, Pine, and GrADS. If you get used to using them things should go much more smoothly. ``C-key'' means Control+key; ``M-key'' means Meta+key or Alt+key (depending on the application). ``Meta'' is the diamond-shaped symbol on Sun keyboards.

key function keyfunction
C-A beginning of line M-Abeginning of sentence
C-E end of line M-Eend of sentence
C-P previous line
C-N next line
C-B back one character M-Bback one word
C-F forward one character M-Fforward one word
C-D delete character M-Ddelete word
C-T transpose two charactersM-Ttranspose two words
C-L refresh/clear/re-center screen
C-spaceset mark
C-W cut from mark
C-K cut to end of line
C-Y paste (``yank'')

Emacs

tcsh

tcsh is an enhanced version of the Berkeley UNIX C shell, csh. Unless you've previously changed your default shell with chsh, you are probably already using it. To determine your shell, use the following:

>echo $SHELL
/bin/tcsh
>

Netscape

ftp

wget, for retrieving remote groups of files quickly/easily

Wget is a command-line, non-interactive utility for retrieving remote files via ftp and http. Examples follow:

warm:~>wget www.cnn.com
--11:13:52--  http://www.cnn.com:80/
           => `index.html'
Connecting to www.cnn.com:80... connected!
HTTP request sent, awaiting response... 200 OK
Length: unspecified [text/html]

    0K -> .......... .......... .......... .......... ..........
   50K -> .......... ....

11:13:52 (187.33 KB/s) - `index.html' saved [66372]

warm:~>
warm:~>
warm:~>wget ftp://ftp.atmos.washington.edu/david/JBS_98.ps
--11:21:05--  ftp://ftp.atmos.washington.edu:21/david/JBS_98.ps
           => `JBS_98.ps'
Connecting to ftp.atmos.washington.edu:21... connected!
Logging in as anonymous ... Logged in!
==> TYPE I ... done.  ==> CWD david ... done.
==> PORT ... done.    ==> RETR JBS_98.ps ... done.
Length: 348,200 (unauthoritative)

    0K -> .......... .......... .......... .......... .......... [ 14%]
   50K -> .......... .......... .......... .......... .......... [ 29%]
  100K -> .......... .......... .......... .......... .......... [ 44%]
  150K -> .......... .......... .......... .......... .......... [ 58%]
  200K -> .......... .......... .......... .......... .......... [ 73%]
  250K -> .......... .......... .......... .......... .......... [ 88%]
  300K -> .......... .......... .......... ..........            [100%]

11:21:07 (501.53 KB/s) - `JBS_98.ps' saved [348200]

warm:~>
warm:~>
warm:~>mkdir lecturenotes
warm:~>cd lecturenotes/
warm:~/lecturenotes>foreach pagenumber (1 2 9 10)
foreach? wget http://www.atmos.washington.edu/my/class/lecture4/page${pagenumber}.ps
foreach? end
--11:27:18--  http://www.atmos.washington.edu:80/my/class/lecture4/page1.ps
           => `page1.ps'
Connecting to www.atmos.washington.edu:80... connected!
HTTP request sent, awaiting response... 404 Not Found
11:27:19 ERROR 404: Not Found.

--11:27:19--  http://www.atmos.washington.edu:80/my/class/lecture4/page2.ps
           => `page2.ps'
Connecting to www.atmos.washington.edu:80... connected!
HTTP request sent, awaiting response... 404 Not Found
11:27:19 ERROR 404: Not Found.

...

warm:~/lecturenotes>ls -l
-rw-rw-r--    1 fleminra uucp            0 Oct 26 11:28 page1
-rw-rw-r--    1 fleminra uucp            0 Oct 26 11:28 page10
-rw-rw-r--    1 fleminra uucp            0 Oct 26 11:28 page2
-rw-rw-r--    1 fleminra uucp            0 Oct 26 11:28 page9
warm:~/lecturenotes>
warm:~/lecturenotes>
warm:~/lecturenotes>wget 'ftp://ftp.data.org/pub/data*.ps'
If the filenames that you want have the form aaa.bbb.ccc.ddd.eee
you will need to use multiple wild cards aaa.*.*.*.eee  

warm:~/lecturenotes>

One of the above scripts uses the "foreach" loop and another uses a
"*" wildcard.  The following uses both.

foreach year ( 1982 1983 )
foreach month ( jan feb mar )
set filename=ftp://daac.gsfc.nasa.gov/data/avhrr/global_1dg/${year}/${month}/avhrrpf.ndvi.1nmegl.
wget $filename'*'
end
end
 
yields an output: 
--17:03:58-- -->
--ftp://daac.gsfc.nasa.gov/data/avhrr/global_1dg/1982/jan/avhrrpf.ndvi.1nmegl.*
           => `.listing'
Resolving daac.gsfc.nasa.gov... done.
Connecting to daac.gsfc.nasa.gov[192.107.190.139]:21... connected.
Logging in as anonymous ... Logged in!
==> SYST ... done.    ==> PWD ... done.
==> TYPE I ... done.  ==> CWD /data/avhrr/global_1dg/1982/jan
... done.
==> PORT ... done.    ==> LIST ... done.

    [ <=>                                                           ]
    1,357          1.29M/s             

17:04:00 (1.29 MB/s) - `.listing' saved [1357]

Removed `.listing'.

...

45 nino% ls 
avhrrpf.ndvi.1nmegl.8201.gz
avhrrpf.ndvi.1nmegl.8202.gz
avhrrpf.ndvi.1nmegl.8203.gz
avhrrpf.ndvi.1nmegl.8301.gz
avhrrpf.ndvi.1nmegl.8302.gz
avhrrpf.ndvi.1nmegl.8303.gz


Suppose you have lots of files to pull over.  Put the filenames in a
file, "file_of_filenames".
foreach filename ( `cat file_of_filenames` )
foreach? wget http://the URL of interest/$filename
foreach? end


Wget is located in /home/disk/tao/fleminra/local/alpha/bin for the Alphas and /usr/local/bin on the Suns. You might consider adding something like this to your .cshrc:

set path=($path ~fleminra/local/`arch`/bin)