Saving and restoring the list of last executed commands