New Unix, etc. Stuff

This file represents things I have learned about unix and a few related areas. My thanks to everyone who has contributed to this list.

Ghostview orientation

The orientation of documents displayed with ghostview can be changed by using the numbers 7, 8 and 9.

keys

Generate public-private key pairs with
ssh-keygen
make a key for a specific Manchester machine, and have a copy of info at SLAC. Then
bbftp -S
uses key I generated (instead of -s and needing password)

wget

wget <URL>
saves a webpage without having to load in browser. Seems to have problems with firewalls/proxies.

Unix utilities

convert - converts between file formats - seems to be available on most machines.

help: convert --help

Other important use: Concatenate files into one file - e.g.

convert file1.ps file2.ps joined_file.ps

 


distill - possibly SLAC only - converts PS to small PDF

Slides and other landscape format latex documents get displayed poorly by ghostview, often when you use 'gv' the document is displayed in landscape format, thereby slicing the edge of the slide. To avoid this (ref: FJ):

dvips -tlandscape -o postscript.ps filename.dvi 
This should make the gv page landscape as well as the actual slides.
changing into a random directory

pushd dirname
to go back to the previous directory, two options (first probably more correct):
popd
cd -
Note - the second option only gets you back to the last directory you were in


Colour-coded directory listings

Caveat: doesn't work on sun1 - possibly on all suns! (Fine on linux)

ls --color
shows files, directories, files with global permits, links, etc, with different colours.
On bash: alias lsc='ls --color'

To see what was edited most recently:

ls -ltr
Flags mean:
l - long listing
t - time ordering
r - reverse order All files (i.e. including dot files) by time order:
ls -altr
To list files in (reverse) size order:
ls -sSr

Don't beep:

In an xterm:

xset -b
(presumably xset +b will reset beeping to normal). In gnome, use terminal-settings-preferences.
Running emacs without X windows:

This is useful for quick editing!

emacs -nw file.tex


Putting in a line of repeated characters:
ctrl-# ctrl-# char
e.g.
ctrl-5 ctrl-6 *
gives 56 stars!
If some leaves a screen locked

can kill session manager with

ctrl-alt-bksp

To shut down properly

(equivalent to "halt" and the login screen)

ctrl-alt-bksp-delete
where here the last two keys are pressed quickly one after other.
Virtual sessions
crtl-alt-F#
useful if, say, netscape locks up session - can go somewhere else and login and kill that netscape process. Default screen is F7.

Copying files across from one machine to another

To copy files across remote machines, e.g., if have files cvjw22ii01.tex and cvjw22ii01.ps on local machine and want to put them on tersk:
scp cvjw22ii01.*
kiwi@tersk.slac.stanford.edu:/afs/slac.stanford.edu/u/br/kiwi/
Note: shire has more memory than tersk

SLAC Printer Queues

Upstairs black and white hpb280r202
  colour hpcolorb280r202
Downstairs colour hpcl4dn1t   (transparencies)
    hpcl4dn1   (paper)
  black and white bbrhp8dn1

...



Run files in the background with root, without having to setup display and without root window and to quit out of root when the process has finished running and to keep the output :
myroot -q -b main.cc >& log.file &

Finding BaBar personnel information at SLAC

From a SLAC computer, e.g. tersk,

person williams

Cool way to use cat to make short files

Use cat > outfile to put standard input (i.e. what you type into the keyboard!!) into a file called outfile. Then tack on: << EOF , where the string "EOF" is a string which, when entered into the keyboard, exits the cat command and causes it to exit, writing everything verbatim that was entered before that string to the file outfile.
cat >myjob <<EOF
. /bfactory/profiles/group_sys.conf.sh
srtpath 8.8.0c SunOS5
cd /export/home/roger/tau/workdir
./betarun ./mydata.tcl 
EOF

More stuff

From Frank Jackson's pages:

Jobs at SLAC

 bkill 0
kills all your jobs
srtglimpse [expr]
searches for [expr] in all subdirectories of the parent of your release


To find a file (searches all paths beneath directory ./ )

find . -name [filename] -print 
To display top 10 disk usage directories (excellent for finding rogue core files or other large one-offs)
du | sort -n |  tail -10l 
Seeing disk usage with just summaries of top-level directories:
du -sk *

To get a listing of all directories below '.':

find ./ -type d
To add directories to your path (I have more notes on this that I must dig out):
setenv PATH directorypath:$PATH 
To find a file (searches all paths beneath directory ./ )
find . -name [filename] -print 


Stopping core files being created

(not tried yet)
With bash, put into .bashrc:
ulimit -c 0
With tcsh, put into .cshrc:
limit coredumpsize 0


Changing orientation with ghostview

e.g. My slides always come out upside down. A quick fix is
ghostview -swap file.ps


Try with latex2html

latex2html -split 3 webtex.doc


LaTeX: ctrl-del deletes the word to the immediate left


rz (and hbook) files are read by paw, root files are read by root. h2root converts rz files to root files.

case-insensitive grepping:

grep -i string

Lund ids Look in package PDT, under pdtlund

e.g. charged kaon is K_plus, K_minus

Sorting out the doctype stuff. Want:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
as the first line - before the HTML declaration anyway. Then in the HEAD, want:
<META HTTP-EQUIV="CONTENT-TYPE" CONTENT="text/html; charset=iso-8859-1">
 
And in the body of the document there are two choices. The best is:
    <A href="http://validator.w3.org/check/referer"><IMG border="0"
        src="http://www.w3.org/Icons/valid-html401"
        alt="Valid HTML 4.01!" height="31" width="88"></A>
To have words, but no image, want:
  <A HREF="http://validator.w3.org/check/referer">W3C Validator</A>
to code a fatal error message:
#include "ErrLogger/ErrLog.hh"
Then
ErrMsg(fatal) << "you are in trouble" << endmsg;
- dies whenever get to the condition that this line is called, but gives this message on dying.
Web wrapping:

To avoid wrapping:

<!-- :WIT:NoWrap: -->
as very first line of html file

If files are already wrapped, unwrap first by doing:

$BFROOT/bin/WEBwrap -rh yourfile.html

Using a2ps:

a2ps -2 -r -E -g -o outfile.ps infile.txt
where:
-r is landscape (-R for portrait)
-2 is for two pages per sheet
-E is pretty-print
-g is for highlight level "heavy", else is "normal", use with pretty-print

Unfortunately the Manchester and SLAC versions of a2ps don't support colour. Enscript is probably a better choice at SLAC, but is not available at Manchester:

enscript --pretty-print=cpp --margins=45:30 --fancy-header=enscript 
--color MySuperProgram.cc -o MySuperProgram.ps
From Manc: Copying slac-based nfs files to manc:
scp -rp
kiwi@noric.slac.stanford.edu:/nfs/farm/babar/AWG25/tauuser_newpaw/* /nfs/hepdata2/jenny/.
our farm page:
/groups/slacb/farming.html
To set permissions on AFS for THIS DIRECTORY and any subdirectories of it MADE IN THE FUTURE to be readable by anyone with AFS access:
cd $HOME    //to do this in my home directory
fs setacl . system:anyuser rl
CARE!! - this includes .globus if I subsequently make a .globus directory, and mail!!. If this is set up this way, and then make a new subdirectory, but want to make it inaccessible:
fs setacl . system:anyuser none

Is this oddly-tagged package older or newer than this other tag?

Best way to check:
listtag BetaSequences | head -20
("head" does similar in unix to "tail", but shows top n lines)

Make me a copy of the Babar Workbook, and preserve all the modification times

cd ...../workbook; cd ..; tar -cvf - workbook | (cd somedir; tar -xfvp -)

More workbook stuff from an old file I had

Header.inc: $BFROOT/www/.wit-root/Headers/www/Workbook

Webtools: $BFROOT/www/computing/WebTeamPages/tools/bin

DIRstamp - an executable

unDIRstamp - makes webwrap not wrap that directory (file?)

WEBwrap -h:

(Mon 8:11) kiwi@shire01 $ WEBwrap -h

WEBwrap wraps/unwraps BaBar navigation headers to your web page

 Usage: WEBwrap [-ah] [-rh] [-t] [-help] <file.html>
  -ah       Add Header (replace existing header)
  -rh       Remove Header 
  -t        Use timestamp of files to determine whether they need rewrapping 
  -help     Display this help file 
  <file.html> the file you want to wrap

 At least one operation is required
-force is also an option used in the web-wrapping files.
Top

Last modified:  
Copyright © 2000-2003 Jenny Williams
All Rights Reserved
Email: jenny@hep.man.ac.uk


Valid HTML 4.01!