- Good Unix Links
- Using the bulletin boards from a Statistics account
- Find files with forgotten names/locations
- Make postscript active in Netscape
- Print several pages per sheet of paper
- Print in reverse order
- Customize your Linux GUI
- Set a default printer
- Fix weird keyboard problems
- Kill garbage characters in a file (e.g. ^M)
- Search for unix commands
- Make a shortcut for a command
- UnPack tar and/or Compressed files
- Pack files into a tar file and compress them
- Use 2 windows in emacs
- Working with columns in emacs
- Make screen snapshots
- Connect to Andrew
- Beep on mail arrival
- Forward Andrew mail
- Setup mail for vacation message
- Use jukeboxes
- Make graph paper
- View MS Word or Excel documents
- Find text in all .tex documents
- Loop through numbered files in a shell script
- Remote access to Andrew from Stat (e.g., for SAS)
For remote Access to Andrew account from Stat account, use:
- How do I use the b-boards from my Stat account?
- Authenticate to Andrew by typing "klog", pressing Enter, and entering
your Andrew password.
- Type messages& to get into the bulletin boards.
- Choose More.../Message Folders/Read By Name then enter a
b-board name, e.g. "cmu.misc.market". A list of top-level
bulletin boards available on Andrew is at
Now the middle window shows the message headers for that b-board.
- Choose Search/Captions backward and enter a search term.
Click on the first match in the middle window to read the message
text in the bottom window.
- You can use control-r/Enter to repeat the search for earlier messages.
You have to click on the header in the middle window to update the
message text in the lower window. (control-s/Enter searches forward.)
- Use message/Quit to quit.
- Can't remember what your file was called? Go to
some directory not below where the file might be, but as
far down the directory tree as possible (for speed), (e.g.
type cd Stat701). If you remember that the letters
"HW" are in the file name, type ffind hw, which
searches all file names starting at the current directory and
working downward, ignoring upper/lower case differences, and
prints out all file names containing those characters.
If you just want to find a directory containing some letters,
If you totally forget the file name, and need to find it
badly, you can search every line of every file for text
inside files using "tfind".
Alternatively use newfiles to list all files created or modified
today, or e.g. old 3 to list all files created or modified
three days ago.
Currently the "*find" commands do NOT
handle embedded spaces or special characters like ">"" or
"<". Also they are interruptible with control-c.
The files are here: ffind ,
dfind , tfind ,
newfiles , old.
You should put these files somewhere in your PATH, e.g.
Another simple alternative is illustrated here. Assume
we want to find a file with the letters "HW" in the filename.
find ~ -name "*HW*"
find , -name "*HW*"
depending on whether you want the search to start in your root or the current directory.
- The unix program psnup allow printing of the pages in a
postscript file in reduced form with several original pages on each
printout page. E.g. to print the file mylecture.ps with 4
pages per sheet on the printer names stain, type
psnup -4 mylecture.ps | stain at the unix prompt.
If you prefer a new postscript file, use
psnup -4 mylecture.ps > lectureX4.ps instead.
- In Netscape, when you click on a postscript or
adobe acrobat file link, do you get a file save dialog?
If so, do the following in Netscape:
- Choose Edit / preferences
- Click on the arrow next to Navigator
- Choose applications / click New
- Fill in Description: Postscript Document
- Click next to application and fill in ghostview %s
- Click OK/OK
- Want to print in reverse order so you don't have to reshuffle
your output? Try psselect -r test.ps | stain to
print test.ps in reverse order on printer stain.
- Want to customize your Linux GUI?
Look at the Linux Manuals .
- In various programs do you have to keep entering the name
of your printer? To make e.g. smear your default
printer, put the following two lines in your .login file:
setenv PRINTER smear
setenv LPDEST $PRINTER
- Do you have weird keyboard problems such as, you can't
get "@" in your mailer, or can't use backspace to erase one
character? The problem is probably in your "stty" settings.
The easiest way to fix this is to put something like the
following in the ".cshrc" file in your home directory.
stty erase '^h' kill '^x' intr '^c'
- Want to remove unwanted characters from a file in emacs?
If you see control characters in your file (e.g. ^M in a file
transferred from a DOS system) you can remove them by combining
the emacs "search and replace" function with the "quote" function. To
replace "^M" with carriage return or a blank, type Esc % to activate
"Query replace", type Ctrl-q Ctrl-m Enter to specify what you
are searching for, after seeing "with:", type Ctrl-q Ctrl-j Enter to
replace with a carriage return or Enter to just eliminate the
funny character, and finally press ! to replace all occurrances.
If the weird character shows up in the form "\245" you will
need to first create a new file with the "\245"s replaced with "^M"s.
To create File2.txt from File1.txt while replacing "\245" with "^M",
use the Unix command cat File1.txt|tr "\245" "\015">File2.txt.
- Don't know/forgot how do do something? Use apropos
and man. E.g. if you don't know how two compare
to files to see if they are identical, type apropos compare.
Look for entries followed by "(1)"; these are Unix commands. You
will find "cmp(1)" on the list. Then type man cmp to see
that cmp file1 file2 compares "file1" to "file2".
My about is better than apropos.
- Want a shortcut for starting a program? Put an alias
in your ".cshrc" file. E.g. alias sp Splus -e makes
Unix interpret "sp" as "Splus -e". To check what an alias
will do, or to check if something is already in use as an
alias or existing program, use which. E.g. on my system,
which sp responds "sp: aliased to Splus -e"; which mv
responds "/bin/mv" to tell me that "mv" is a program located
in the "/bin" directory; and which a responds
"a: Command not found" to tell me that "a" is not in use.
- How do I unpack/extract the files in a .tar file that I downloaded?
If the file ends with ".Z" or ".gz", first unzip/uncompress it with
gunzip file.tar.Z or uncompress file.tar.Z to create the
plain "tar" file.
Then execute tar xvf file.tar to extract all of
the files inside the tar file. Then read the README file. You may, e.g.,
need to run "make" or carry out other steps described in the README.
Also note that tar tvf myfile.tar shows the contents of
the tar file without extracting anything.
- How to I pack files into a tar file and compress them?
To pack up all or some of the files in a directory into a single
small file, get into the directory using cd, then execute, e.g.,
tar cvf myfile.tar * or tar cvf myfile.tar *.dat
to pack the specified files into myfile.tar. Use, e.g.,
tar uvf myfile.tar *.log to add all log files to existing tar
Use compress myfile.tar to replace myfile.tar with a smaller
compressed version call myfile.tar.Z.
- Working with 2 windows in emacs. You can split the emacs screen
into 2 windows to work on different parts of the same file, different
files, or to have an S-within-emacs session in one window with a text
(e.g. source and/or output) file in the other window.
To open a second window, type Ctrl-x 2; type Ctrl-x o or
use the mouse to switch to the other window; type Ctrl-x 1 to
revert to a single window. When you first open a second window it
shows the same file as the first window; to put another, already-opened
file in the window, use the Ctrl-Left Mouse Button menu or
Ctrl-x f and the name of the file; to put an unopened file
into a window, use Ctrl-f and the file name (or Ctrl-r
for read-only); to open a new file in a window, use Ctrl-f and
a new file name. You can change the relative sizes of the windows:
e.g. to make the current window 5 lines bigger (at the expense of the
other window) type Ctrl-u 5 Ctrl-x ^.
- Working with columns in emacs. You can cut and paste columns
(rectangles) in emacs. For instance you could cut out the fourth column
of a table and paste it into the second column position. The procedure is:
put the cursor in the upper left corner of the rectangle to be cut; mark
the corner by using Ctrl-SpaceBar (use Ctrl-g to cancel this
if done in error); move to the lower right corner of the rectangle with
the arrow keys, Ctrl-e, or by searching with Ctrl-s; cut
out the rectangle with Ctrl-x r k
(not Ctrl-x Ctrl-r Ctrl-k); if the cut is incorrect use
undo (Ctrl-Shift-Underscore) to undo it; if you want to paste
the cut material, in column form, in one or more places, put the cursor
at the upper left of the paste position and type Ctrl-x r y.
- screen snap shots:
You can make screen snaps from xv. Right click to get the xv menu. Choose "Grab".
This works best if you have automatic window raising set in which case, don't
bother with the "delay". Instead just click "Grab", "float" the window you want on top, and either
left click to get the whole window or middle click and drag to get a region.
- Want to connect to Andrew? From your statistics
account, you can make your andrew files available by
typing klog your-Andrew-userid and then supplying your
Andrew password. Now your Andrew files are available for
listing, editing, etc. via the file path
ls \afs\andrew\usr\~billyjoe lists files in your
Alternately you can type telnet unix.andrew.cmu.edu
then enter your Andrew userid and password. Now you are
actually running programs on Andrew. When you want to exit
your Andrew account, use logout.
To actually run programs on Andrew, e.g. the version of Splus
to which undergrads have access, using X-windows, do the following.
First klog to make the file system accessible. Then
run xhost + unixnn.andrew.cmu.edu where nn is the number
of a particular Andrew machine. (You can do a quick login/logout
via telnet to identify such a machine.) Then do
slogin unixnn.andrew.cmu.edu. Now you are on the
Andrew machine, and you can run any
X-windows stuff, e.g. graphs in Splus, and they show up on
- How can I make my computer beep when mail arrives?
Just run xbiff. Even if it is minimized, it will beep
when mail arrives.
- Want to forward your Andrew mail to your Statistics account?
Telnet to andrew (see previous tip).
Type forward email@example.com to send all
Andrew mail to userid on the statistics department computer
network. Type forward -r to see what
your current forwarding is. Type forward -z to cancel
Or try CMU Email and Calendar.
- To setup your mail for a vacation message start in your root (top)
directory and 1) make a text file named .vacation.msg with
the message that you want people to see, and 2) make a file called
with the line \myid, | "vacation myid". Replace
myid with your username and include the backslash,
vertical bar (pipe) and quotes. Also, don't add extra spaces. Anyone
e-mailing you will get your vacation message as an automatic
reply. (Delete .forward when you return.)
- How do I use the optical jukeboxes? Instructions are now at
CMU Stat Computing .
- How do I make my own graph paper? Use lines
with a command string like lines 2 3 >2x3.ps to make a postscript
printable file with horizontal lines 1/2 cm apart and vertical lines
1/3 cm apart (2x3.ps). Or use this
1x1 cm paper.
- Use the soffice program to view Microsoft Word .doc files in Unix.
- Use the looktex program to search for a word or phrase in
all .tex documents in the current directory.
- Here is a sample csh shell script called cshlooping
that operates on a fixed width sequence of numbered file names.
Test it with source cshlooping 4 to get results
easy way (count)
robust way (arrays)
klog (access andrew accounts from elsewhere)
# If you don't know your usr#, use "pwd" after logging in.
# Now read/copy files:
# Actual remote connection (e.g., to run SAS)
# Find current IP address:
/sbin/ifconfig (Shows "inet addr")
# Need to set Xconfig for X-Win32 "Allowed Host Addresses" to the inet addr
# if, e.g., emacs, gives "Display ... unavailable" message.
# Need to set unix display for x-window services
setenv DISPLAY myName.stat.cmu.edu:0.0
# Now you can use emacs, SAS, etc.
# (Use cp /afs/andrew.cmu.edu/usr19/logInName/myFiles . in a Stat window
# to copy your work back to your stat account.)
All links active 2/28/2006. Please report missing links to
To my Home Page