Arduino (1) Bugs (3) C (1) Install (3) Linux (25) Maths (1) Python (11) Raspberry Pi (4)

Monday, 31 August 2015

Recalling previous linux commands you have entered

Being able to find commands you have run can be helpful if you cant remember what you have just done or need to run the command again.

While your in a terminal you can use the up arrow to view previous command and this is usually ok for the last few commands but if its any more than that it can become tedious to find it.

To find a command used recently run

 history | grep "PART OF COMMAND"

Make sure to put the space before the command as this stops that current command being added to the history

To run the command last run again

!! also the same as !-1

To run the last command starting with something i.e ifconfig


To run the command second most recent