history n
where n is the number of commands you have typed before.
Example:
This lists the last 5 commands typed before:
$ history 5 510 cp /home/pepito/myfile /home/pepito/myfolder 511 ls 512 ip addr show 513 ifconfig 514 history 5
You can select to execute a command from the list with the following:
!n
Where n is the number of the command in the list.
Example:
This will execute the command number 511 that is the ls command:
$ !511 ls example.txt
0 comments:
Post a Comment