Skip to content. | Skip to navigation

Laboratoire d’Etudes en Géophysique et Océanographie Spatiales

Personal tools

This is SunRain Plone Theme


You are here: Home / Members / Alexandre Ganachaud / TRICKS


by Alexandre Ganachaud — last modified Feb 05, 2013 11:31 AM

This document contains tricks.


OS notes by A. Ganachaud. Use at your own risks.

For html editing, see the beginner's guide to HTML.




Programming the keyboard

xmodmap: (Careful ! Can loose control of the keyboard.)

First, save the current modmap: xmodmap -pke > .key_defaultmap
Second, use a new map: xmodmap .keymap_PC that one programs French accents for F1-F4 for a particular keyboard.
To change settings, first find the key code of the keyboard using xev, then modify file.
Programming F1 in such a way can be incompatible with some programs (ex. netscape). Consider this alias:
alias netscape 'xmodmap .key_defaultmap && netscape \!*' to come back to the initial keyboard map.


Find out why it's slow.
ping : check the machine is alive
traceroute : show the pathway (and possible slow points)
route ????

Up: General Menu


auto remote ftp

1-create .netrc file in home directory, containing lines:
machine <remote computer name> login <remote login>   password <remote password>
2-read-protect this file !
3-open remote file under emacs: open-file, /<remote computer name>:filename

Delete a rectangular column

to delete a rectangular column in emacs:
C-sp (at upper left corner)
then move cursor to lower right corner
C-x r k
then move cursor to new upper left corner
C-x r y



Create partition

fdisk /dev/hdd (for disk hdd)
Create for instance 1 extended partition that contains all logical partitions
Commands, n, l
tiki: used exactly identical partitions
Then: v, w

Format partitions:

mkfs -t ext2  /dev/hdd? (create file system)
note: gives where superblock backups are if the main inode is lost
mkswap /dev/hdd6


fsck -r  /dev/hdc?


mount -t ext2 /dev/hdd12 /export/data1
df -k
mount dans fstab: attributs (e.g., 1 1)= passage de fsck
see also auto.master, auto.home1 etc.
CDROM problem: to make it executable
mount -o remount,exec /mnt/cdrom


Edit /etc/exports
exportfs -a

Repair disk:

fsck -r  /dev/hdc? on each partition
mkfs -t ext2  /dev/hdd?  if necessary

When crash

To reboot:

init 6 for instance, (see /etc/rc.d/init.d or /etc/inittab): reboot
init 5: X11
init 3: no X (use startx to lauch KDE)
init 2: without NSF
init 1: single-user
init 0: halt
Floppy: boot linux-single

Error messages:


Prompt commands:

alt-F1 --- F12: switch to different consoles

Error messages:

add line to /etc/syslog.conf
*.* <tab> /dev/tty12  : direct all error messages to console 12 (also in /var/log/messages)
/var/log/dmesg: boot problems

Double disk mirror

From J. Grelet (documentation from Abidjan):
script to copy individually partitions of one disk to identical partition of another disk
lines are of the type
dd if=/dev/hdc5 of=/dev/hdd5
e2fsck [-p] /dev/hdd5

Tiki: partitions 5-10 from hdc to hdd
11-12 from hdd to hdc
Added to root crontab (crontab -l):
0 2 * * * /usr/local/sbin/gw-raid (everyday at 2)

To have second disk bootable:
1-make bootable floppy (see below)
2-change master/slave
3-boot on floppy (May need to change bios config for that)
4-type /sbin/lilo: MBR is written

RAID with Fastrack

(insmod pdcraid)

modprobe pdcraid
fdisk /dev/ataraid/disc0/disc

finally disabled (problems).

need to change append line:
less /proc/pci
and in lilo.conf: append="ide2=IO1,IO2+0x002,IRQ1 ide3=IO3,IO4+0x0002,IRQ2

make a bootable floppy

mkbootdisk --device /dev/fd0 2.4.3-20mdk

Boot after primary disk crash

boot on floppy
type /sbin/lilo
Change fstab to have everything mounted on the same disk (hdd11-12 should become hdc11-12)


Example: program fetchmail

Where is it ? /usr/bin/fetchmail
options: ~root/.fetchmailrc
1) copy for instance deamon script sendmail/ modify to create /etc/init.d/fetchmail
2) check:   /etc/init.d/fetchmail start
/etc/init.d/fetchmail stop
3) put links in rcX.d:
cd rc3.d
ln -s ../init.d/fetchmail S81fetchmail
cd ../rc5.d/
ln -s ../init.d/fetchmail S81fetchmail
cd ../rc0.d/
ln -s ../init.d/fetchmail K31fetchmail
cd ../rc6.d/
ln -s ../init.d/fetchmail K31fetchmail

F90 license start

/init.d/rc.local: added
case "$1" in
if [ -f /opt/PGI/linux86/bin/lmgrd.rc ]; then
/opt/PGI/linux86/bin/lmgrd.rc start && echo 'PGI lmgrd.rc'
if [ -f /opt/PGI/linux86/bin/lmgrd.rc ]; then
/opt/PGI/linux86/bin/lmgrd.rc stop  > /dev/null 2>&1
echo "Usage: $0 {start|stop}"
exit 1


From J. Grelet:
See crontab on Tmp/Config_jacques/var/spool/cron/root
Script: /usr.local/sbin/sauvegarde
Added to crontab (at 6 in the morning every wed and sat)
0 6 * * 3,6     /usr/local/sbin/sauvegarde


write /etc/printcap
cd /var/spool/lpd
mkdir dro10 etc...
cd /etc/init.d
./lpd restart
also X-config with printool,but not very effective.

Config Staroffice 5.2 printers:
chmod o+w  /opt/office52/share/xp3/Xpdefaults
spadmin (does not work as root on tiki)
and modify Xpdefaults manually if necessary

Start staroffice 6.0:
run -> crash -> chmod +x .user60.rdb

drivers dans pc-print (info) ik9
pc-totem: phaser
domain: info

New kernel

Tiki: have to rebuild the kernel because RAM exceeds 1Go
No ! finally update with Mandrake 8 .1, and got 1.5Go available. See also Kernel (failed) compilation notes.

CD burner

Use xcdroast ( to burn cd's. xcdroast knowns only scsi -mounted burners -> emulation (It seems that it was all installed at first run)
in lilo.conf: add append="hdb=ide-scsi" (type lilo to write MBR)
lsmode: check that ide-scsi loaded
cd /dev
rm cdrom2
ln -s scd0 cdrom2


USB lock at shutdown

The computer locks up when shutting down or when stopping the usb service.
Why: In certain cases, the usb-uhci module is broken for some usb devices.
Solution: Modify your /etc/modules.conf file and change the line "alias usb-interface usb-uhci" to
"alias usb-interface uhci". The change will take effect after the next shutdown and will prevent the
usb service from locking up the computer.


rsync -avz /local/website/ -e ssh ganachaud@host1:/home/web/people/htdocs/ganachaud/
rsync -avzu --list-only --delete --exclude Zique --exclude Photosperso /local/ /media/ieee1394disk/local/
rsync -avz /local/Hydrosys/ -e ssh ganachaud@host2://Users/ganachaud/Hydrosys/

Accents with kmail

go configure-composer and send in iso-8859-1
remove from list utf-8, utf-8 (locale) and us-ascii

Signal Processing

Spectral Analysis

Spectrum: normalizations:

Percival & Walden, p.118:
xhat=dt sum(x exp(-i2pint/N))
x      = ds sum(xhat exp(i2pint/N))
and Parseval:
dt sum(x^2) = ds sum( xhat^2)
So that autocovariance is
acv=ds sum(xhat xhat* exp(i2pint/N)) = 1/dt * ifft(xhat xhat*)
acv(1)= dt sum(x^2)

But this way, spectrum energy increase with lenght of time series. Better divide everything by lenght, Ndt

xhat=1/N sum(x exp(-i2pint/N)) = 1/N fft(x)
x      = N ifft(xhat)
and Parseval corresponds to variance = energy/Ndt
1/N sum(x^2) = sum (xhat^2)
acv = N ifft(xhat xhat*)

Uncertainty of coherence and phase:
non-zero coherence test: see matlab function  cohereconf.m.
Phase: see Bloomfield, 1976, p.225:
95% error bars: +/- 1.96 g sqrt(0.5(1/c^2-1)) in radian. Valid for large c. g is equiv to 1/deg. of freedom (g=sum(gk^2) where gk are the wights of the smooting function)
More exact:
asin(Tu(0.05)sqrt(0.5 g^2 / (1-g^2) * (1/c^2-1)). Becomes imaginary for M < 4 See function coherephaseconf.m

Voir fonction  spectmat .


To get right size of scanned image:
Set scanner and output resolution to 150 dpi
Check that image is 100% of original
Check image size in photoshop
save as gif 150 dpi entrelace


Installation on ubuntu 5.10

Notes from UW site, adapted


Change directory to /unix/r14sp1 then download the three files mathworks-r14sp1-1.iso, mathworks-r14sp1-2.iso and mathworks-r14sp1-3.iso to your computer.

R14SP2 and R14SP3: (Service Pack 3 is the latest as of Sept, 2005)

Change directory to /unix/r14sp2 then download the three files MathWorks_R14_1.tar.gz, MathWorks_R14_2.tar.gz, MathWorks_R14_3.tar.gz to your computer. These are tarred/gzipped formatted files. Unpack these files into separate directories MathWorks_R14_1, MathWorks_R14_2, and MathWorks_R14_3. Run the install program from the first directory.. If installing extra toolboxes you will be prompted for the location of the second and third folder.

Installing the software

The license file must be placed into the $MATLAB directory before the installation begins. Move the file called license.dat into the $MATLAB directory.

Mount the CD-ROM drive you intend to use to install MATLAB. Next, create the installation directory and move to this new location by using the cd (change directory) command. Do not specify the name of the location with a space, an at (@) sign or a dollar ($) sign. For example, to install into the location usr/local/matlab7, use these commands:

cd /user/local (changes the directory to the root for the user)
mkdir matlab7 (A directory named matlab7 will be created.)
cd matlab7 (changes the directory to matlab7)

To run the Mathworks Installation, follow the appropriate command for your platform:

(For Sun & Linux platforms)

Run this setup program to begin installing Matlab.

Updates to Matlab software can be downloaded via FTP from ( The userid and password for this were sent to you with your UW license. This ftp site requires you to use a non-secure ftp program.
The next window that will appear is the license file popup. While a picture of this menu is not shown in this document, the only available option is to click OK to proceed. The next menu will be the Installation Options menu.

By default Matlab will be selected to Install the program files and the documentation. The installation of the documentation is optional. Only select the programs from the list that your license covers. By default, all programs will be installed, but only those you licensed will work.

The checkbox option to create symbolic links to MATLAB is optional. This is mostly recommended, because without these shortcuts, the absolute location of the application binary must be executed. Mex scripts are Matlab specific. This option is not required, however useful to have enabled.

Updates have already been downloaded to a UW distribution server and are accessible in the directory "latest_updates".

Please refer to the readme.txt file on the CDROM image for details on the R14 product list image installation. Complete installation instructions are included in the PDF format file inst_doc.pdf on the CDROM image.
Matlab Post Installation Instructions

These steps install the Flexlm License manager that will allow Matlab to execute.


root@your-machine# cd /opt/matlab/etc/
root@your-machine# cp rc.lm.hp /etc/init.d/flexlm
root@your-machine# chmod 555 /etc/init.d/flexlm
???root@your-machine# echo "FLEXlm_MATLAB=1" > /etc/rc.config.d/flexlm
root@your-machine# cd /etc/rc3.d/
root@your-machine# ln -s /etc/init.d/flexlm S900flexlm
root@your-machine# cd /etc/rc2.d/
root@your-machine# ln -s /etc/init.d/flexlm K100flexlm
root@your-machine# cd /etc/rc5.d/
root@your-machine# ln -s /etc/init.d/flexlm K100flexlm

Now you have to edit /etc/init.d/flexlm and change "username" in start) to an account you want to run the License Manager under.

root@your-machine# vi /etc/init.d/flexlm
root@your-machine# /etc/init.d/flexlm start

Now you're ready to run Matlab

root@your-machine# /matlab14/bin/Matlab


Resolving Errors in the license.dat File

The license.dat file requires a specific format for the passcodes and information specific to the system MATLAB is used on. Each line in the license.dat file must begin with INCREMENT or # and the file distributed through the UW license program is formatted this way.
Linux users must change the SERVER line after running the installation. The Matlab/FlexLM installation adds the following line to the license.dat file.

SERVER hostname hostid 27000

But under our UW site license #164896, the hostid must be replaced using ID = license_number.
The Server line should then look like:

SERVER hostname ID=164896 27000

(This does not apply if you've been issued a multi-user concurrent license)

After making the above change to your license.dat file, you must stop/start the license manager. Make sure you are in the directory where the license.dat file is located, then enter the commands:

Must start with DAEMON MLM /opt/matlab/etc/lm_matlab



mex files: changed options of compiler in .matlab/R12/ to -r8 to have default real *8
integer fortran arguments:
as input: read them as real and pass them to the function with INT()
as output: read them as integer and fill the pointer with REAL(x, 8)

R14: check in /opt/matlab/bin/ and /bin/scripts

removed -lstdc++ from mex -v compilation line

PGI license

type  /opt/pgi/linux86/6.2/bin/lmutil lmhostid
>lmutil - Copyright (c) 1989-2004 by Macrovision Corporation. All rights reserved.
>The FLEXlm host ID of this machine is "000fb0a7272d"
to get to license key go to

follow /opt/pgi/INSTALL.TXT

sudo cp /opt/pgi/linux86/6.2/bin/lmgrd.rc /etc/init.d/lmgrd
% ln -s /etc/rc.d/init.d/lmgrd /etc/rc.d/rc3.d/S90lmgrd
sudo ln -s /etc/init.d/lmgrd /etc/rc3.d/S100lmgrd
sudo ln -s /etc/init.d/lmgrd /etc/rc5.d/S100lmgrd
sudo ln -s /etc/init.d/lmgrd /etc/rc6.d/K80lmgrd

PDF Files manipulation

concatenate files:

  1. try texexec --pdfarrange --result 123.pdf 1.pdf 2.pdf 3.pdf
  2. or install pdfjam:
  • pdfnup puts multiple document pages together on one physical page at a reduced size
    - pdfjoin concatenates multiple PDF documents
    - pdf90 rotates the pages of PDF documents



Image resolution with word

  1. Solution 1 (recommended) use openoffice with eps image with tiff preview (matlab)
  2. Solution 2 (good to waste time) save (e.g. from adobe) as jpeg at 300 resolution and the right size from the beginning
  3. PDF: when word export, set to high quality (more than 600dpi)

Document Actions