ahtml> Krane's UNIX Cookbook

Krane's UNIX Cookbook

or

UNIX info you can't find easily

_________________________________________________________

If you accidentally jumped away from your window manager to text-screen by hitting ctrl-alt-f1, get back with ctrl-alt-f7.

In VMWare, first do ctrl-alt-space (which means send this sequence straight through) then do the ctrl-alt-f7.

_________________________________________________________

To set a conditional breakpoint in totalview.
set a typical breakpoint
right-click on that breakpoint
change break to "eval"
in the eval window type (for example):
  if ( myvar < 0.0 ) $stop

(See also my Run II coding cookbook .)

_________________________________________________________

To edit rectangles in emacs...
[ctr] [space]   set mark
[ctr]-x r k     kill rectangle (remove it)
[ctr]-x r y     paste killed rectangle

_________________________________________________________

To get out of the VI editor...
[escape]:x[return]  (to save)    or   [escape]:quit![return]   (quit with no save)

sometimes you need [f1] instead of [escape] on some wacky machines...

If you absolutely must use the VI editor, then:

i     insert text mode, then type at will
[escape]     command mode

From command mode:

x     delete current cursor position
p     undelete
h,j,k,l     cursor left,down,up,right

_________________________________________________________

To debug shell script (like SET VER in VMS)

	csh -x file.name

To debug executables

	cvd file.x &

_________________________________________________________

***To setup/compile/link a d0user frame

      setup code.pbd with userlib under OBJECTS
	issuepbd.csh  --> my script issues pdb with options,
			  removes useless VMS-type files,
			  resets rwx priveleges.

	compile.csh --> compiles w/D0$flavor, makes userlibs, links


_________________________________________________________

***To Unzip a file:

      gunzip *.gz
or
      uncompress *.Z

_________________________________________________________

***To untar a file (de-archive):

      tar tf *.tar (shows you what is in the archive...t=table of contents, f=diskfile)  

        tar -ztf *.tar.gz    if it is zipped.

      tar xvf *.tar   (unpack it...x=expand, v=verbose, f=diskfile)

      tar -zxf *.tar.gz if the thing is zipped. 

*** To tar a set of files in current directory and all subdirectories into target.tar:

    tar -cvf target.tar *

_________________________________________________________
File transfer

To email a file to yourself
mail jkrane@mydomain.gov < myfile.txt 

_________________________________________________________

ftp to and from NT machines
(This is wierd because you tell ftp to connect to d0server1 yet the files actually go to and from d0server4. Hey, I just work here...)

To put a file onto the NT cluster

ftp d0server1 
username:  dzero/jkrane    <-- note "dzero" before username!
put myfile
 ...etc.
(look for your file in d0server4/FTP-IN)

To get a file from the NT cluster

ftp d0server1
username:  dzero/jkrane    <-- note "dzero" before username!
cd /users/jkrane
get myfile
 ...etc.

_________________________________________________________

Folder: COMPUTERS From: jonckhee@d0nt63.fnal.gov Subject: Moving directory trees from VMS to Unix Date: 08-JUN-1999 10:30 There are at least two ways to move whole directory trees from VMS to Unix:

1) use vmstar (see d0tng (or FNALD0)::lib:[lib.vmstar]) to tar the directory

tree. On VMS:

       setup vmstar
       vmstar --help
       vmstar -cvf xx.tar [.direct...]*.*
   ftp the tar file then use tar on Unix to untar it:
       tar -xvf xx.tar

2) use normal VMS backup to create a backup file on VMS. Then on d02ka:

setup vmsbackup vmsbackup --help vmsbackup -xvdf xx.bck

The latter has the slight advantage that the backup file can be restored

onto VMS again if needed.

Alan (Jonckheere)

_________________________________________________________

***To put my ntuples onto /ute740 I have:

setup fmss

in your .login file and then

fmss cp disk:/(your_dir)/(sourcefile) mss:/(dir)/(destinationfile)

HEY!! You literally need "disk:" and "mss:" in the command!

you can also mkdir, mv, ls, chmod, rm (fmss -r rm xxx for directories), and


fmss query filename to test the existence of a file

	0 = file exists

	1 = no permission for path, etc.
	2 = does not exist
	3 = symbolic link
	4 = directory
       (5 = file on HSM tape storage)
       (6 = file on HSM disk)
       ( only appears for  fmss -x query filename)

__________________________________________________________

***To print from netscape I use
flpr -h fnprt -q d0tce_hp8000

__________________________________________________________

Want to use d0x on a unix machine? Guess what...only the gamma library version works!

libtest -g xframe
d0setup xframe
d0x

When you're done, type "clean_d0x" to get rid of all the links.

__________________________________________________________

To move DST's from the challenge to the alphas, I use FTP and the following commands:


FTP> binary
FTP> quote site rms recsize 32760
FTP> put (etc.)

--------------------------------------

Ntuples are a different breed of cat. You need to find the recsize unique to your ntuples.
To find the correct recsize, use one of two methods:
********* Method 1 (Find the correct size by looking at an Alpha-resident ntuple)

D0TNG > dir/full myntuple.nt

and find the "Fixed length xxxxx byte records" line. Use the proceedure for DST's and use xxxxx as the recsize.

********* Method 2 (Find the correct size from the Challenge ntuples)

Make sure your challenge ntuple is named with the .hbook extension, i.e. "something.hbook". Rename it if you have to.

Begin a PAW session on the challenge.

PAW > h/file 1 something.hbook

You will get a warning like:
"RZOPEN: LRECL inconsistant - file was opened with LRECL = 1024 should be LRECL = yyyy"

Use the proceedure for DST's and use the value 4*yyyy as the recsize.

(To move standard QCD ntuples from the challenge to the alphas, I used:
FTP> binary
FTP> quote site rms recsize 32764
FTP> put (etc.)

__________________________________________________________

Graphical comparison of two files

gdiff -w (which means "ignore whitespace." The gdiff man page is available under "man xdiff.") Emacs has to the commands "tabify" and "untabify" to convert spaces to tabs and vice versa in the selected region. Enter using Esc-x or Alt-x.

__________________________________________________________


Return to Krane's Computing Page