A few useful unix commands to start with

  • cd a_directory         - (change directory) move to the specified directory
  • mkdir a_directory      - make a new directory
  • ls                     - list the files in the present directory
  • cp old_file new_file   - copy a file
  • mv old_file new_file   - rename or move a file
  • less file              - shows the content of a text file, one page at time; you get next page by pressing the space bar and quit the program by pressing q. h gives you help and more useful commands.
  • lp file                - write out a file on the printer
  • lp -d copls            - write out a file on the colour printer
  • firefox&              - starts a web browser; goto http://www.teokem.lu.se/~ulf/Methods for further instructions
  • rm a_file              - remove a file
  • rmdir a_directory      - remove a directory
  • exit                   - close a window
  • man command            - gives you information (help) about command
  • kill -9 process_number - kill a proces
  • xemacs&                - opens a text editor, which is reasonably self instructive. In particular, it is very useful to copy or remove rectangular areas. You do this by marking the rectangle from the left upper corner to the lower right corner and then press ctrl-x r k (rectangle kill). You paste a rectangle by puting the mouse in the desired position of the upper right corner and the press ctrl-x r y (reactangle yank).
  • You open a new window by on the K in the lower left corner, then select terminals and a proper terminal (e.g. shell). Write . .profile in the new terminal to make it look normal (note the two dots, with a blank in between).
  • You lock the screen by pointing on the lock in the lower right corner.
  • File system
    Four directories are special:
    .   means the current directory
    ..  means the parent directory (one step up)
    ~       means your home directory. You can also go to your home directory by writing cd without any argument.
    -       means the last directory you visited.
    Thus, cp ../file .  copies file from the parent directory to the current directory.
    The file system is hierarchically arranged in directories, starting from the directory /.
    You can either specify the actual name of the directory or the file (e.g. /teo/ulf/file; If you double-click on the Esc key, the system completes the name of the file or directory if it can be unambigously determined) or give the name relative your current directory (e.g. ../../Directory/file or ~/Directory/file).

    Characters and keys
    Note that unix is case sensitive, so that the file apa is different from APA and Apa.
    Some keys are special:
    *  is a wildcard key; it corresponds to any number of any characters. It can be combined by other characters, e.g. file*apa
    & starts a job in the background (i.e. you write job& )
    Ctrl-P repeats the last command (and the commands before than if you repeat it; the arrow-up does the same thing on most keyboards).
    !com - repats the latest command starting with "com"

    You can copy and paste in and between windows by marking something with the left mouse button and then paste it with the middle mouse button. In some applications the text ends up where you click. In others (e.g. in the unix window) it ends up at the cursor position.

    A much more detailed tutorial can be find in http://bioinfo1.mbfys.lu.se/kurs/uNix.html or in
    http://www.redhat.com/support/docs/faqs/rhl_general_faq .

    Ulf 28/3-01

    Some useful data

    Some pdb viewers

    Some useful Unix/Linux commands

    1. Install new commands on ubuntu linux:
    apt-get install command
    apt-cache search command

    ctrl-alt-F1/F2 goes out of KDE
    ctrl-alt-F7/F8 goes in again
    %!PS-Adobe-2.0 EPSF-1.2
    %%BoundingBox: 0 290 480 760

    Some Linux information

    You can change your keybord configuration by /usr/sbin/kbdconfig (sometimes only arrow buttons works here)
    It can also be changed in the file /etc/X11/XF86Config-4

    The mouse configuration can be changed by /usr/sbin/mouseconfig

    File systems:
    ext2: old Linux
    ext3: new Linux (journalising)
    vfat: Linux compatible with windows 95/NT

    The fileserver is installed (VV 26/1-18).
    in order to NFS mount it:
    /etc/fstab should have:

    gersemi:/disk           /gersemi             nfs          defaults 0 0

    and you should create /gersemi directory, of course...
    sudo mount -a

    Due to security - all computers (IP addresses) with nfs access
    should be set - so, currently, only gefion can access gersemi.
    if you give me the list of IP addresses - I will set them up.

    KUbuntu Linux - change setup

    1. K-icon - Computer - System settings - Workspace appearance - Window decorations - Plastic
    2. System settings - Workspace behavior - Screen edges - Uncheck Maximize windows by dragging them to the top of the screen
    3. System settings - Window behavior - Window behavior - Titlebar actions - Titlebar double-click - Lower

    4. Konsole - Settings - Configure current profile - Appearance - Black on light yellow
    5. Konsole - Settings - Configure current profile - Advanced - Characters considered part of a word when double clicking - remove ":"

    New Mac

    Instructions from Mikael: https://github.com/teokem/guides

    Use Migration assistant to update all files (No, I used TimeMachine)

    Install first
    XCode (from App Store)
    Macports (from https://www.macports.org)
    XQuarz (search on internet; needed for x-windows applications; not mentioned by Mikael any longer; seems to apply only to Mac OS 10.5-7)

    Programs can be installed by Homebrew brew .
    brew search program
    brew install program
    Many MacOS applications can be installed with the --cask keyword from the command line with brew:
    brew install --cask xquartz firefox libreoffice zoom

    Before, we used MacPort (Xcode needed) instead.
    Mikael recommends you NOT to install both.
    If you do anyways, make sure the brew directory (/opt/homebrew/bin) is first in your PATH variable.
    port search program
    sudo port install program
    port puts the install files in /opt/local/bin

    xemacs (only ports, but failed for new Mac)
      Finally managed to download a usable version from https://emacsformacosx.com
    pymol also failed for the same reason
       conda install -c schrodinger pymol


    Install by finding dmg files on internet
    Adobe Acrobat Reader
    LibreOffice (Vanilla can be bought in AppStore; Does not work)
    MsWord (from LU, see Mikael's page)
    Mendeley (does not work in Word)
    Maestro (fungerar inte)

    To get Fortran: install the latest version of gcc (e.g. sudo port install gcc7)
    brew install gfortran

    On the M1 you can run x86 binary command line tools through Rosetta emulation. This is done automatically and in the background. To see if a file is arm or x86, use file <executable>


    VPN (to be able to use LU services, e.g. get pdf files) LU support - Nätverk/VPN; note that use costum install, only VPN) Now: FortiClient

    After a system update, you typically have to update Xcode and MacPort and then reinstall all programs again,

    Copying files from local disk on Lunarc

    Följande text är tagen från Lunarcs User's Guide och gäller för Platon. På Alarik ska motsvarande fil heta $SNIC_TMP/slurm_save_files, dvs. "slurm" istället för "pbs", och där kopieras filer/kataloger även på slavnoder.

    Saving local files
    If a job is terminated prematurely, for example, if it exceeds the requested walltime, the files on the local disk (in $SNIC_TMP) will be lost. Files that would still be useful can be listed in a special file $SNIC_TMP/pbs_save_files. Filenames are assumed to be relative to $SNIC_TMP and should be separated by spaces or listed on separate lines. These files will be copied to $PBS_O_WORKDIR regardless whether the job ends as planned or is deleted, unless there is a problem with the disk or node itself. For parallel jobs, only files on the master node will be copied. Note that this feature is unique to Lunarc.

    Magnus 12/9-12

    Backup of /home

    Subject /home daily backup
    From Francesco Aquilante
    Date: Mon, 08 Mar 2004

    Hi everybody,
    backups of your home directories are now available on signe.
    Those are only "incremental" backups, taken daily (during the night),
    thus they only contain files which have been modified within the last 24 hours.

    The backups are located in /garmhome/backup on www.
    Each directory on this filesystem is named Garm-xxxxxxxx
    where xxxxxxxx indicates the date of backup (yesterday's backup, for instance
    is named Garm-20040308). In each of these directories you will find the file
    $USER.tar.gz  which corresponds to the daily backup of your home directory (as long as
    you modified any file that day... actually the day before that date, to be precise!).

    OBS!!! The filesystem that hosts the backups is mounted as read-only. This means that if you want
    to operate on the archives (extract, for instance) you need to copy them somewhere else (scp from www is allowed).

    As a rough estimate, you should be able to recover files directly on this filesystem if modified
    not earlier than 1 month ago. If you need older versions of your files as well as files that
    have not been modified within last month, then you should contact me in order to recover them from the tapes.
    backups of your home directories are now available on signe.
    Those are only "incremental" backups, taken daily (during the night),
    thus they only contain files which have been modified within the last 24 hours.

    Date: Fri, 20 Sep 2002 11:35:37 +0200
    From: "Francesco 'Roos Guest'" <francesco@signe.teokem.lu.se>
    Subject: no more "tilda files" using vi editor

    Hejsan Teo,

    there has been a lot of gossip about these annoying backup files generated after any minor saved change in the text using vi editor. Finally, Ifound out how to get rid of this "clever" default. It is very easy indeed. Just looking at the man page
    of vi, I've been guided to the file
    copying this file in my home dir. with the name .vimrc and making the following "brutal" changes

    "if has("vms")
    "  set nobackup         " do not keep a backup file, use versions instead
    "  set backup           " keep a backup file
    set nobackup

    thus commenting that conditional statement and setting the default tonobackup,"tilda files" disappeared !!

    Likewise, you avoid the stupid indent default by the following change:
    "set autoindent         " always set autoindenting on
    set noautoindent

    setenv MP_SET_NUMTHREADS 2

    There exist a default .profile in /etc/profile.

    The mail services seems to work as it should. If you want your mail from garm to be re-directed to signe you must create a '.forward' file in your home directory on garm. In that  file you write on the first row:

    For those of you who are interested in using Swedish letters, make the following modification in netscape.
    When you have netscape running, go to the edit menu and choose
    preferences/Mail and Groups/Messages/more options
    under the square with 'send messages .....'
    klick on 'using the "quoted printable"......'

    The default maxium memory usage for a single processor in IRIX is 512 MB
     To get beyond 512MB one  needs to increase the kernel parameter shmmax to the desired level.
    You then need to re-build the kernel and reboot with this new kernel.

    Date: Mon, 30 Sep 2002 10:29:50 +0200
    From: "Francesco 'Roos Guest'" <francesco@signe.teokem.lu.se>
    Subject: Helper Applications in Netscape... thus on-fly PDF and more !!!
    Hi everybody,
    Some of us (not Valera!) were looking for the way to open a PDF or PS file
    while browsing the net with Netscape. One of the simplest ways to do
    it is to configure the "Helper Applications" :
     Edit -> Preferences -> Navigator -> Helper Applications -> New Type
    I suggest you to add the following MIME types (be sure to specify
    them according to the scheme!)

    -francesco               APPLICATION
    PDF                  application/pdf            /usr/bin/xpdf
    PS                   application/postscript     /usr/bin/ggv
    DVI                  apllication/x-dvi          /usr/bin/xdvi
    XLS                  application/vnd.ms-excel   /usr/bin/gnumeric
    DOC                  application/msword         /usr/bin/kword
    BMP                  image/bmp                  /usr/bin/kview
    MPG                  video/mpeg                 /usr/X11R6/bin/xmovie

    For further information see also the following and related pages:

    Lycka till,

    You can now retrieve your own files yourself. The procedure is very simple:
    1) login on signe
    2) > export DISPLAY=your.display
    3) >nwrecover
    This will give you a graphical interface were you can mark the file you wish to recover.
    You will be able to retrieve files that are several months old. The first backup available through nwrecover is a full backup taken on the 19th.
    nwrecover will prompt you weather you'd like to overwrite the existing file or not.
    If not it will put the file in the same location with a .R extension.

    The latest ssh2 has been installed in ssh1 compatibility mode,
    meaning there should be no problem with login to and
    scp (use the command scp2 -1) from machines running only ssh1.

    ex. scp. if I want to copy a file from embla to my directory on my local temp1 disk
    scp2 -1 username@embla:/usr/people/username/filename /temp1/username/

    NOTE : Remember to take away all you alias and so on concerning location of ssh, ssh1, ssh2.
    You just have to type ssh and automatically the correct ssh is used.

    ROOT 30/5-01

    lp -dps -c -o number-up=2 -o sides=two-sided-short-edge
    lp -dps -c -o sides=two-sided-long-edge

    Making the presentation using a projector without a laptop.

    (c) Juraj Raab & Valera Veryazov, 2004

    Stage I. Preparing the presentation

    Prepare your presentation in ps or pdf format, Login to pc.teokem.lu.se (uid scanner)

    convert t.pdf -size 1024x768 a%02d.jpg or
    convert t.ps -size 1024x768 a%02d.jpg

    To rotate portrait-oriented slides to landscape type

    convert a*.jpg -rotate "90<" %02d.jpg
    rm a*.jpg

    (landscape pictures will be intact)

    Stage II. Moving the presentation to memory stick

    The card reader is plugged into the machine 'lage', in the same room where the Windows machine is (non smoking room).
    Mount the card reader

    mount /mnt/reader  No longer needed.
    mkdir /mnt/reader/Ulf
    cp *.jpg /mnt/reader/Ulf
    umount /mnt/reader

    Stage III. Performing the presentation

    Plug the memory stick into the projector. Press the Menu button, navigate to the Picture Viewer mode. Navigate into your directory on the memory stick, come to the first slide, 'enter', select 'Full Screen'. Use cursor keys 'left' and 'right' on the remote control for navigation.

    Stage IV. After the presentation

    Take out the card, plug it back to the reader, mount it again and remove your presentation from the card. Leave the card in the reader for others to use.

    A small addition to these instructions for users of OpenOffice/StarOffice.

    Pdf files from OpenOffice/StarOffice seems to have some small problem with convert, so first use pdf2ps on your pdf then use convert on the ps file and everything works fine.

    pdf2ps myfile.pdf
    (this gives myfile.ps)

    This is a short instruction how to set up Thunderbird as a default mail program.

    1. run gconf-editor
    2. Navigate to /desktop/gnome/applications/url-handlers/mailto
    3. edit the "command" field and change it's value to "thunderbird %s"
    "enabled" should be checked, "needs_terminal" unchecked.

    Valera 081104


    after several years of wondering why we needed to have a windows machine in order to
    use the scanner, somebody solved the riddle...
    The almost "Fil. Mag." Kristoffer Lundgren has finally got the scanner working under
    linux (Slackware) and he is now going to explain you how to use it:

    First you log in as user "scanner" with the password xxx (notice the upper case on the password).
    Then you start XSane by clicking the icon on the desktop (which has a Beer icon associated with it thanks
    to Francesco) and start scanning. First aquire a preview, then do the real scan when you have marked what
    areas to scan etc. XSane allows quite a few more adjustments, but for that read the manual.
    Save your file/picture somewhere under /temp1. To reach the picture/s from your workstation, simply
    use scp, ie

    kristoffer@hugin:    scp scanner@pc:/temp1/my_pic.ending .

    Got to know:

    1) Only from our network it is possible to reach pc.teokem.lu.se but not the other way around.
       Btw, the only user is "scanner"

    2) It is possible to reboot the machine to Windows (freshly reinstalled with service pack2).
    OBS!!  unless unavoidable, if you restart the computer under windows UnPlug the network cable!

    3)  /temp1 is readeable also under Windows, so it can be used to transfer files to and from that machine !!

    4)  the only account under windows is "Guest" and is passwordless

    5) besides the OS itself, the only softwares installed under Windows are acrobat and firefox

    to prove that the scanner works, we attach a sample picture. As you can see, it seems that under Linux
    the scanner works fine and can even make people look younger ... upon request!

    Glad Påsk,
    Kristoffer  &   Francesco  050323


    as the webserver of TeoKem has been moved from signe to a new machine,
    you might want to move your personal webapages to the new location.

    How to do it?

    tar -cvf pub.tar public_html
    scp pub.tar ulf@mimer:/home/ulf
    ssh mimer (special password)
    ssh www (same password as on local system)
    scp mimer:pub.tar .
    tar -xvf pub.tar

    No: now you have to login to www (via mimer) and scp from there directly to your local computer.
    scp ulf@gefion.teokem.lu.se:/home/ulf/public_html/Methods/* .

    1) create a tar-ball (zipped) of your public_html directory contents on signe:/teo/$user/public_html/

    2) scp this file to mimer

    3) from mimer:     ssh www                  (www is the new webserver, accessible through ssh only from mimer)

    4) on www:
                   scp mimer:mytarball .
                   mkdir public_html

    5) extract to content of the tar-ball in your public_html

    So the location of your webpage will simply
    be at   /home/$user/public/html

    Best regards,
    -francesco 050328 and 29

    bup ska vara exekverbar
    nobup är listan med kataloger som utesluts (gäller även underkataloger), ska ligga i din hemkatalog (eller så ändrar du platsen i bup)

    mvh patrik

    Dear Teo,
    I was asked (several times) about a problem with configuration of thunderbird as a default mail program.
    Without such set up - if you click on a mail link in firefox - a strange screen with 'evolution' configuration

    So, this is an instruction:
    In Firefox's Location (URL) Bar, enter "about:config" and then press <enter>
    # With the cursor in the body of the resulting page, <right-click> the mouse.
    #  From the pop-up menu, select "New".
    #  From the next pop-up menu, select "String".
    # In the pop-up dialog box "Enter preference name", enter "network.protocol-handler.app.mailto" (without quotes), and click "OK" (You might wish to cut-and-paste that phrase to ensure correct spelling).
    In the pop-up dialog box "? network.protocol-handler.app.mailto", enter "/usr/bin/thunderbird"

                   Valera (070102)

    # Shell script that does full/incremental backups /home/$USER
    # revision 020318
    # Setup
    DATE=$(date "+%Y%m%d.%H%M%S")
    if [ -r "$TIME" ]
    # Save some dot files
    cd $SDIR
    for file in `/bin/ls -F -d .[a-z]* .[A-Z]* | grep -v '/' | sed 's/\*//' | sed 's/@//'`
    cp $file "Save/x$file"
    # Create list
    cd $SDIR
    for x in `/bin/ls -a`
    if [ "$x" = 'Install' ]
    elif [ "$x" = 'Cache' ]
    LIST="$LIST$x "
    # Print information
    echo "Source directory: $SDIR"
    #echo "Target directory: $TDIR"
    echo "Target file: $TARGET"
    echo "List: $LIST"
    # perform backup
    if [ "$MODE" = 'full' ]
    cd $SDIR
    echo "Backup mode: Full"
    echo "Wait ..."
    find $LIST -type f | tar -cz -X $SDIR/nobup -T - -f $TARGET
    touch $TIME
    cd $SDIR
    echo "Backup mode: Incremental"
    echo "Wait ..."
    find $LIST -type f -newer $TIME | tar -cz -X $SDIR/nobup -T - -f $TARGET
    touch $TIME
    ls -l $TARGET
    # Copy to server, if possible
    if [ "$SCP" = 'yes' ] ; then
    ssh $HOST -l $LOGNAME ls -l $RDIR
    if [ -w "$RDIR" ] ; then
    echo "Copying $TARGET to $RDIR ..."
    cp $TARGET $RDIR
    # Done
    exit 0



    Patrik, 070619
    Hej på er

    Här följer en samling blandade tips och tricks jag samlat på mig under åren här.
    Program som nämns nedan är:
    convert (imagemagick)

    Rotera ps och konvertera till eps
    ps2eps -f -R + -g -s a4 input.ps output.eps
    bra för att ta hand om eps från gnuplot

    Konvertera bilder till tiff med cmyk och LZW kompression - bästa format för publicering
    convert filnamn -colorspace CMYK -compress LZW nyttfilnamn.tif

    Sammanfoga flera pdf-filer till en enda i bestämd ordning och gör till a4 samtidigt
    pdfjoin filnamn1 filnamn2 filnamn3 --fitpaper false --paper a4paper --outfile allt.pdf

    Hur man skapar numrerade formler i Openoffice Writer
    skriv "fn" först på en rad, tryck sedan F3.

    kommandon för högupplöst bild för tryck i pymol (konverteras sedan lämpligen med convert till tiff)
    ray 3000x4000 (eller nåt sånt)
    png filnamn.png

    gör alignment och beräkna rmsd av två strukturer av samma molekyl i pymol
    skriv följande kommande med de residue ids du vill aligna och
    struct1 och struct2 är namnen på de två strukturerna i pymol
    fit (struct1 and resi 1-3), (struct2 and resi 1-3)

    Göra posters grafiskt
    använd programmet scribus

    Rensa epsfiler till renare filer
    eps2eps filnamn.eps nyttfilnamn.eps

    Program för att hålla reda på projekt, anteckningar, tips m.m.
    Zim (desktop wiki)

    The ps printer has problems printing certain PDF files. When this happen the cue to the printer locks and one can't print. So please try to print PDF's on a different printer.

    If you can't print with lp -dps filename try the following.

    Go to the following address

    and follow the instructions.

    Jimmy Heimdal, 080904

    Subject: Multi-Machine

    Dear All!

    The new Printer/Scanner/Copier is now installed and ready to be used, the default settings might be changed later so it is a good idea to do printer profiles on your computer.
    It is five times more expensive to print in colour than BW, so please only use colour if you really need it.

    The printer has the IP and is called Ricoh Aficio MP C5501 PS and if you have the user rights to do so you can now add the printer to your computer.
    I will print some easy How-To and put on the wall for guidance, but everything is pretty straightforward.

    When you scan and send as mail the sender is scanner@fkem1.lu.se and the subject isMessage from "RNP0026731BCCFA".
    For your convenience I advice you to add your address to the address book so you do not have to write it every time.
    Settings for scanning can be changed on the screen, Scan Settings situated in the upper left corner.
    You can save to folder but not USB or SD card, please tell me if you like to have this feature, personally I find scan to E-mail easier to use.

    To add you address on the scanner:
    In the left row press the physical button marked '123' (the first button),
    From now on use the On-Screen Menus.
    Press 'System Settings',
    Press 'Administrator Tools' (to the right) and then Address Book Management in the left sub meny,
    Then press 'New Program' (to the right) and then add information by pressing Change for Name, Key Display and also 'Select Title' so you easily can find you address. e.g.for Hirst this button is GH.
    Press OK (upper right corner)
    Then press E-mail (top and middle), Change and write you E-mail address.
    Press OK twice, and then Exit three times.

    Kind regards
    Christopher Hirst (via Ingrid 15/4-11)

    If you have any problems I suggest that you contact Per-Olof or Valera. / Torbjörn

    New Laptop

    Move from old haddisk

    MacPorts (Xcode?)
    Fastest Free YouTube Downloader


    New account

    xxdiff (fldiff)

    Please, remember to set up an account on mimer, make directories on the /temp and /away disks, install the programs we usually miss: csh, xxdiff, sshfs, and vim, and update vi.

    Problems with emacs fonts

    emacs*font: 7x14
    to ~/.Xdefaults
    and execute
    xrdb -merge ~/.Xdefaults

    Good commands to tidy up

    gzip -r *

    chmod -x *.gz
    chmod -x */*.gz
    chmod -x */*/*.gz
    chmod -x */*/*/*.gz
    chmod -x */*/*/*/*.gz
    chmod -x */*/*/*/*/*.gz
    chmod -x */*/*/*/*/*/*.gz
    chmod -x */*/*/*/*/*/*/*.gz
    chmod -x */*/*/*/*/*/*/*/*.gz
    chmod -x */*/*/*/*/*/*/*/*/*.gz
    chmod -x */*/*/*/*/*/*/*/*/*/*.gz
    chmod -x */*/*/*/*/*/*/*/*/*/*/*.gz
    chmod -x */*/*/*/*/*/*/*/*/*/*/*/*.gz
    chmod -x */*/*/*/*/*/*/*/*/*/*/*/*/*.gz

    find * -name gradient.gz -delete
    find * -name g1.gz -delete
    find * -name diff_dft_density.gz -delete
    find * -name diff_dft_oper.gz -delete
    find * -name diis_errvec.gz -delete
    find * -name diis_oldfock.gz -delete
    find * -name diff_densmat.gz -delete
    find * -name diff_fockmat.gz -delete
    find * -name dens_cao.gz -delete
    find * -name force1.gz -delete
    find * -name force2.gz -delete
    find * -name job.[0-9]*.gz -delete