Sep 29, 2008

Linux Version?

A friend asked me how to find out which linux version he is using. Strictly speaking, what he meant was not the linux kernel version, but he was referring to distribution and version of distribution.

A simple way to get some system information is uname -a, but this only tells you about whether you are using GNU/Linux and the version of the linux kernel.

There are several possibilities to determine the distribution and version.

First possibility:

The command cat /proc/version gives you the kernel version, the build, release, and distribution you are running.

On the beowulf cluster:

Linux version 2.6.27.9-73.fc9.x86_64 (mockbuild@) (gcc version 4.3.0 20080428 (Red Hat 4.3.0-8) (GCC) ) #1 SMP Tue Dec 16 14:54:03 EST 2008


On my desktop at work:
Linux version 2.6.27-9-generic (buildd@yellow) (gcc version 4.3.2 (Ubuntu 4.3.2-1ubuntu11) ) #1 SMP Thu Nov 20 22:15:32 UTC 2008

Second possibility:

You can also list the /etc/*release, /etc/*version, and /etc/issue files.

On the beowulf cluster I do cat /etc/*-release and I get: Fedora release 9 (Sulphur)

On my desktop I get, also on the same command:

DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=8.10
DISTRIB_CODENAME=intrepid
DISTRIB_DESCRIPTION="Ubuntu 8.10"

Sep 28, 2008

Good News from Space

On Thursday morning a Chinese spacecraft launched. Part of the astronauts' mission was a spacewalk, the first spacewalk in the history of Chinese space missions. Dialogs between the astronauts in space were also published. However, these were taken down after a day and we were told the agency had had technical problems. After all what other reason could there be for posting the dialogs while the craft was still on earth?

Now that's all past. The spacewalk is completed. After all, the dialogs were real.

-
Thanks to /. contributors for posting links to the news reports.

Update: Want to know what internet is like behind the great Chinese firewall? A firefox plugin lets you explore the Web from China--without leaving home.

Sep 26, 2008

Killing Processes in Linux

A friend asked me, how to kill processes in linux. Killing processes in linux is done using the function kill. By default kill sends term signals to the processes and waits until they terminate. The option -9 speeds this up. kill takes the process id as argument, however often you want to specify rather the name of the program. In this case you can use pkill. xkill allows you choosing a window on the screen and kill the program directly by mouse click.

While I was working under MacOS Tiger, where I couldn't find the pkill command, I wrote my own small pkill shell script. I still have it in my ~/.bashrc as fast finishing move.


#pkill, kill process by name
function pkill { # kill processes by name
kill -9 `ps aux | grep $* | grep -v grep | tr -s " " | cut -f 2 -d " "`
}


By the way, in linux you can always get help by some commands:
man - most important command, the manual of commands, e.g. man kill
info - hypertext formatted multipage documentation. In some cases very extensive. Try info kill.
apropos - search the manual page names and descriptions, try apropos kill
whatis - just searches the names of commands

Sep 21, 2008

"Mavericks"

Maybe you thought it was bad enough that Americans vote presidents that we Europeans would only laugh about if reality wasn't so sad. News coverage of election campaigns inundates us with trivialities (that's what they call lipstick politics, I guess) and chances are, the next president is a general and the vice president a Christian fundamentalist, who want's to introduce education of science topics such as naked girls and snakes. See Sarah Palin talk about god's grand plan for America and abortions among other things. "My experience in international politics? Look, I live in Alaska. We have a border with Russia." Really, how bad can it get?

See some more quotes from the Sarah Palin quotes generator.

Audiobooks

After the last two weeks of summer school, with the last weeks spent on two summer schools, I feel completely exhausted and near stupor. To do something useful, I was listening to an audio book, A Short History of Nearly Everything. The author, Bill Bryson, states that he became aware that he knew nothing about science and there was a lack of material which was accessible, puts it all together, and answers the right questions. That's what he does and he's not bad at it. From a link in wikipedia, I discovered errata.wikidot.com which is a site, where you can correct errors in books, such as this one.

Just in case, you don't know librivox, if you are searching for audio books of classic literature, this maybe the site for you. Librivox is a community project for people to read books which have passed into the public domain. This is mostly true for books where the author died at least 75 years ago (though IANAL). On the internet archive (surely you have checked out Murnau films or the wayback machine, right?), which hosts their projects, you have a nice portal, which shows you most popular books over the last month or the last week.

This video here explains downloading audio books from librivox.



--
P.S. As of late november, the new version of vlc, there is a feature of reproducing faster and slower works! I had tried it had never worked before. So, if i am bored by some audio book (or just the speaker) or music, i can just accelerate ;).

Sep 13, 2008

Influential Scientists

I am currently attending the Barcelona Cognition, Brain, and Technology summer school, where I am learning about a broad range of topics including theories of attention, models of brain function, brain prostheses, and consciousness. I am highly impressed by some of the speakers, many of which are luminaries of their fields. I think one of the finest talks in terms of rhetorics, structure, and communication skills was held by Karl Friston. His institute homepage identifies him as one of the ten most cited scientists in neuroscience. This is confirmed at in-cites.com.

Searching for Karl Friston I noted an oddity: why doesn't he have a wikipedia article? I challenge you to search for wikipedia articles on scientists top-listed at in-cites.com. Please tell me if you can find any of them at all. You can speed-up search using wikiwax which provides a suggest-feature.

Sep 8, 2008

ECRO 2008 in Portorož, Slovenia

Last week, I have been to the ECRO conference 2008 in Portorož, Slovenia. Portorož lies at the shore of the gulf of Trieste, next to Piran, a nice little town of 16,000 inhabitants with medieval architecture. The port of Piran, as well as the port in our hotel, was full of yachts. Alpha Romeos at the entry of the next door 5 star hotel of the same complex (poor engineers, we had to stay in the 3 star hotel) evidenced financial well-being of guests.
ECRO stands for European Chemoreceptor Research Organization. Program of the conference spanned from 8am until mostly 11pm, so there was not much time to regain sleep after our outward journey from Barcelona which had began for me at the airport on time at 6am. Hotel managers know they are not paid to improve the food and maybe this was another contributing factor to my head aches and numb drowsiness on the second day after our arrival.
The same day we had an excursion to the Postojna Cave (de: Adelsberger Grotte, it: Grotte di postumia), one of the country's top tourism sites, where mineral and calcium carbonate residuals of water dripping over millions of years from ceilings of the limestone cave have formed stalactites as seen in every Indiana Jones or in the shape of noodles, stalacmites, and impressive columns from both.

We saw Lipizzan horses, a breed, associated with the Spanish riding school, and originated in the 16th century during the Habsburg reign. During its history parts of today's Slovenia had belonged not only to Austria but also to the Holy Roman Empire, Hungary, the Ottoman Empire, Napoleonic France, and Yugoslavia until gaining independence in 1991 following a popular referendum and the 10 days war against Belgrade.
As for the conference, Marcus Stensmyr showed considerable qualities in telling his research in a fashion marked by understatement and dry humor, and therefore I declare him best speaker for his talk about olfaction in Yeti fly, the fly's courtship behavior and genetic influences therein, evolutionary bottlenecks, and cayman crabs. Worth reading: Yeti fly in crabitat. Marcus had better videos at his talk, but here is one I found on google video on fly courtship.

Automated Backup using Subversion

Subversion is a software for version-control that allows you to store changes you make to files, so you can revert edits, restore deleted files, and much more. If you are new to subversion you might want to start with my introduction to subversion, where I explain how to use subversion (svn) for making incremental backups of your data to a repository and keeping track of different versions of your files. In this post I explain how to use svn to store automatic periodic updates of your repository.

The situation is the following: being a human you have a weak memory and you might forget committing changes to your repository. You want an automated commit every day to your repository. You have one or more machines where you edit your files and one remote server, where you have the repository (check the earlier blog entry for this).

We'll proceed in two steps: 1. creating password-less ssh access to the server. 2. using anacron to automate the svn commit.

Step 1: You'll need password-less access by ssh to the server from your computer. Our new way of accessing the server is actually harder to break than a password. It is straightforward.

You create a public key, either an RSA key [wikipedia] or a DSA key [wikipedia].
> ssh-keygen -t rsa
or
> ssh-keygen -t dsa

Accept the default locations for saving the public key (~/.ssh/id_rsa or ~/.ssh/id_dsa) and press enter twice for empty password.

Now we have to install the newly created public key on the server. This works by appending the public key to your ~/.ssh/authorized_keys (check the server's /etc/ssh/sshd_config if you are not sure about the file). Let's use the tool openssh provides us with.
> ssh-copy-id -i ~/.ssh/id_rsa.pub remoteserver

(substitute id_dsa.pub if you use DSA).

Now we should have password-less ssh access to the server.

Step 2: Automate subversion. Cron is a unix program which allows us to schedule execution of jobs at intervals specified in days. Anacron catches up on jobs that haven't run because the machine was switched off, so we are save if anacron is enabled (in ubuntu check under system -> administration -> services).

The configuration file for cron has the following format (column-separated by white spaces):
minute hour day_of_month day_of_week command

An asterisk (*) means every instance.

We edit our cron configuration by typing crontab -e and add a new line, e.g.
0 4 * * * svn commit localpath -m 'daily update'

This means we want to execute svn commit at 4:00 every day. localpath is the directory that you wish to have under regular version control.

That's it and it should work. See ubuntu community cron howto for more examples on the use of cron.

In another post I compare some commercial providers of remote backup servers.