This simple command "history" shows a numbered list of your past commands. 1720 sudo chgrp -R www-data batch 1721 sudo chmod -R 766 batch 1722 ls -al 1723 sudo chmod -R 776 batch 1724 cd batch/full/ 1725 pwd 1726 exit 1727 mv build.xml.ant /var/www/test/site/sites/default/files/behat_yml/batch/full/ 1728 cd /var/www/test/site/sites/default/files/behat_yml/batch/full/ From there you can choose a number from the output and run !1725 To quickly rerun the command