I have received this arduino (together with other hardware) with a demo program installed. I would like to save the program on my PC just in case i would need it to test the hardware one day. Is this possible somehow? It's a mega, btw. So i cannot take the uC out... I'm running Linux on the PC.
Of course this would give the binary and not the source.
This comes up from time to time. No it is not a very practical thing to do.
In your case when you just want to restore something that is already in then you could use a programmer to do a memory dump and store it as a file. Then restore it again with a programmer. But there is no way to do it without buying extra hardware that you will only use for this task, unless you get into blowing your own bootloaders.
Time to study avrdude and maybe improvise programmer hardware. That will be handy anyway, sooner or later... Of course I will first try to get the source.
If you have an Arduino board, it has the Arduino bootloader, right? (If you can talk to it through the Arduino IDE, it has the Arduino bootloader.)
As long as the bootloader is in place, the serial (USB) interface can be used by avrdude to read and write the ATmega memory with no other programmer hardware or software required.