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 | key | function |
---|---|---|---|
C-A | beginning of line | M-A | beginning of sentence |
C-E | end of line | M-E | end of sentence |
C-P | previous line | ||
C-N | next line | ||
C-B | back one character | M-B | back one word |
C-F | forward one character | M-F | forward one word |
C-D | delete character | M-D | delete word |
C-T | transpose two characters | M-T | transpose two words |
C-L | refresh/clear/re-center screen | ||
C-space | set mark | ||
C-W | cut from mark | ||
C-K | cut to end of line | ||
C-Y | paste (``yank'') |
(column-number-mode t)
to your
~/.emacs
file. This will force Emacs to display
the current column number in the status line in addition to to
the line number.(global-font-lock-mode t)
to
.emacs
to force Emacs to display ``rainbow code.''show-paren-mode
. It is useful for keeping
track of which parentheses match which. (i.e. in Emacs press
M-x, then type ``show-paren-mode[enter]'')
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 >
ls-F
instead of ls
. It will
display a ``/'' after directory names, a ``@'' after names of
symbolic links, and other characters after other types of
files. You may want to add this line to your
.cshrc
file: alias ls ls-F
.setenv PAGER less
to your
.cshrc
. This will force many UNIX commands
(e.g. man
) to use less
when they
would otherwise use more
. less
is
an enhanced version of more
.alias less 'less -i'
to your
.cshrc
. This way searches within
less
will be case-insensitive.set
prompt="%m:%U%c03%u>"
in your .cshrc
.
This will display a prompt like
tao:~/proj>
or
tao:/<2>data/mosaic/computer_helps>
.
The <2>
in the latter indicates that
two directory components were omitted for brevity (the full
directory is
/home/tao/data/mosaic/computer_helps
). You can
customize your prompt to display a variety of items (see
man tcsh
).set watch=(1 any any)
to your
.cshrc
. This will force tcsh
to
inform you of when people log in/out of the computer you're
using.setenv HOSTALIASES ~/.hosts
to
your .cshrc
, and create a file
~/.hosts
like the following:
home-pc c662854-a.sttln1.wa.home.com spot spot.colorado.eduWell-behaved UNIX commands (ftp, telnet, X-windows) will honor these aliases.
alias set_title 'echo -n "^[]2;"$HOSTNAME\:$tty"^G^[]1;"$HOSTNAME"^G"'to your
.cshrc
and
if ($TERM != "ansi") then set_title endifto your
.login
. This will force
tcsh
to set your xterm/rxvt/dtterm/?? window
title to the name of the computer you're logged on to. Note
that it will not be reset when you log-out of a computer
you've telnetted to. (You could put something in your
.logout
for that.) Note also that the ^[ and ^G
above must be actual control-codes. You can enter them in
Emacs by preceding the tricky character by ^Q. The check for
$TERM != "ansi"
is to protect the incompatible
Microsoft telnet clients.ignoreeof
is
not set). Control-D when the cursor is at the end of
the (non-empty) command line will list possible completions
(filenames, shell variables, and environment variables), e.g.:
warm:~>echo $t[Control-D] tcsh term tty warm:~>echo $tThe third use of Control-D is to delete the character under the cursor, if the cursor is not at the end of the line. It is also possible to invoke the completions-list mechanism from within a command line by preceding Control-D by Control-X. (Try these yourself.)
ftp
'' instead of
``anonymous
'' as your username when doing
anonymous ftp.. easier to type.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
For pulling over whole directories in situations where the "wget" "times out":wget -q -O - http://domainname/directoryname/ | wget --forced-html -i -
The "-" in the first part tells wget to output to STDOUT, the "|" tells the shell to pipe the output of the previous part to the next part, the "-i -" in the second part tells wget to read from STDIN (the STDOUT from the first part). Sean Bailey of FUTURETECH / NASA GSFC provided this very useful information. For wget sessions timing out, one can also usewget --tries=n --timeout=m http://...
where "n" is the number of times to try and "m" is the number of seconds to wait before "timing out." Harry Edmon provided this solution. It is common now for data files to be written with one directory per year of data. To pull over just the data files, and not the directory trees:wget -r http://directoryname --no-directories --accept nc
This will also work for ftp. The "accept" option says only bring over files with the .nc extension.