Bash utils #0000: Retrieving old commands and executing it

Finding in history a command and run it without typing it

Last update: 2022-06-16
history |grep [command you forget (docker for me)]
# output
# 3688  docker container ps
# 3690  docker container prune
# 3691  docker image prune
# 3692  docker-compose up --build
# Then, run command by number
!3692
# This will place 'docker-compose up --build' on your prompt