CD to a folder like:
mkdir $HOME/Desktop/Backup_Arduino
cd $HOME/Desktop/Backup_Arduino
Set these variables
Arduino Nano Old Bootloader:
export BOARD=atmega328p
export PORT=/dev/ttyUSB0
export BAUD=57600
export PROGRAMMER=arduino
export AVR_DIR=/usr/bin
Arduino Uno:
export BOARD=atmega328p
export PORT=/dev/ttyUSB0
export BAUD=115200
export PROGRAMMER=arduino
export AVR_DIR=/usr/bin
Arduino Mega:
export BOARD=m2560
export PORT=/dev/ttyUSB0
export BAUD=115200
export PROGRAMMER=stk500v2
export AVR_DIR=/usr/bin
$AVR_DIR/avrdude -n -C /etc/avrdude.conf -c $PROGRAMMER -p $BOARD -P $PORT -b$BAUD -U eeprom:r:eeprom.bin:r -U flash:r:flash.bin:r -v
echo "Restore with: $AVR_DIR/avrdude -C /etc/avrdude.conf -c $PROGRAMMER -p $BOARD -P $PORT -b$BAUD -D -U eeprom:w:eeprom.bin:r -U flash:w:flash.bin:r -v -v" > readme.md
zip fw_backup.zip readme.md eeprom.bin flash.bin -T
$AVR_DIR/avrdude -C $AVR_DIR/avrdude.conf -c $PROGRAMMER -p $BOARD -P $PORT -b$BAUD -D -U eeprom:w:eeprom.bin:r -U flash:w:flash.bin:r -v -v