Can i recover code back 2 my pc off my arduino?

Can i recover a code that i have running in my arduino? my computer took a dump and lost the code in my sketch book. But the code was up loaded to the arduino before the trouble started. so now i would like to try to save the code some how. Dose any one know how to do this or can it even be done?

Thank you for your help.

Sketches are compiled into machine code - a binary format that is hard to read by people. This binary form is downloaded into the Arduino by the bootloader.

If you have an AVR programmer, it may be possible to read back this binary form of your program. It then takes a disassembler to convert the binary form into a low-level form (assembler) that is readable by people. But this is not a sketch.

The bottom line is that your sketch is lost unless you did a backup, or can remember what you did and can rewrite it again. Sorry to tell you this bad news but look at it as a lesson learned - do regular backups.

The code might still be on your drive.

Something like

strings /dev/sda | grep "void one_of_your_lost_function_definitiions"

or similar might be a quick check to see if you still have a partial or better amount of the file still.