Blog Image


Tar specific file(s) recursively

Linux Posted on Fri, July 04, 2008 12:27:01

find . -name regfeat_cbl.dat > list.txt
tar zcvf regfeat_cbl.tar.gz –files-from=list.txt

Recursively delete files

Linux Posted on Wed, June 18, 2008 13:19:13

Back again with a handy command I forget all the time…

find /from/this/directory -name \*.tmp -exec rm {} \;

this will recursively delete all *.tmp files from /from/this/directory and higher.

To let find ask for a confirmation for each file, do this:

find /from/this/directory -name \*.tmp -ok rm {} \;

Replace tabs with spaces

Linux Posted on Wed, May 21, 2008 08:01:31

To convert all tabs to 5 spaces you can use the following perl command line:
(replace ___ to spaces)

perl -e ‘($_ = join “”,<>) =~ s/(\t)/_____/g; print;’ < input.txt > output.txt

Copying symbolic links from remote PC

Linux Posted on Mon, March 31, 2008 12:24:59

Normally you would use scp to copy files between PC’s, but it will follow every symbolic link and copy the data instead of the symbolic links themselves. With rsync however you can copy symbolic links.

rsync -azuv -e ssh user@host:/remote/directory /local/directory

Searching within files

Linux Posted on Tue, March 11, 2008 08:31:16

To search for files recursively containing a certain string (not in the filename, but in the file itself):

find . -name ‘filename’ -exec grep -H -i “searchstring” {} \;

Broken links

Linux Posted on Mon, March 10, 2008 08:20:46

To get a list of broken links on your system, do a

( find / -type l | xargs file ) | grep ‘broken symbolic link’ | cut -d”:” -f1

to get a filelist of broken links.

kNN in Weka

Linux Posted on Wed, January 30, 2008 12:02:52

To use the kNN classifier in Weka (Waikato Environment for Knowledge Analysis) you have to click on the label under
‘Classifier’, and then choose ‘IBk’ from the drop-down menu.

The option ‘KNN’ defines the number of neighbors.
‘distanceWeighting’ option allows to adapt the influence of the
neighbours according to their distance, and ‘crossValidate’ searches for the best “k” value using crossvalidation.

Exporting Messages from Evolution

Linux Posted on Wed, October 24, 2007 14:26:46

There is a File | Import… menu item in Evolution, but no corresponding Export menu item. However, you can export messages from Evolution into the well known mbox format, by doing the following steps:

– Select the folder in Evolution you want to export
– Select Folder | Select All Messages from the menu.

– Select File | Save Message… from the menu.
– Choose location and filename where to save the emails,
preferably with extension .mbx
– Click OK

Disadvantage is that it needs to be repeated for every folder.

No icons in evolution

Linux Posted on Tue, October 16, 2007 11:11:46

If you get the following warnings, and there are no icons in Evolution, you probably have a non-existent theme selected in the gnome theme manager.

Gtk-WARNING **: Unable to locate theme engine in module_path: “qtengine”

One of the probable causes is that some themes get deleted/updated when installing gnome updates.

This can be fixed by running gnome-theme-manager and select a different, existing theme.

SSH Tunnel

Linux Posted on Thu, September 06, 2007 10:28:26

To tunnel IMAP via SSH to localhost if you are using xs4all:

ssh -C <usernaam> -L

Your mailclient should then be configured to read mail on server localhost:11143