Write last runned command to a file