August 29, 2012

Find old bash commands in Linux

Use a wicked one-liner last week, but forget what it was? Search your bash history with grep! If you remember part of the command, you may be able to dig it up.

I was messing around with php-cs-fixer last week, and could not remember what commands I tried out. Searching with

history | grep fixer

found me:

1333  php-cs-fixer
 1337  php-cs-fixer fix src --dry
 1338  php-cs-fixer fix --dry-run src
 1339  php-cs-fixer fix --dry-run --level all  src
 1340  php-cs-fixer fix --dry-run --level PSR2  src
 1341  php-cs-fixer fix --dry-run --level psr2  src
 1342  php-cs-fixer fix --dry-run --level=psr2  src
 1343  php-cs-fixer fix --dry-run --level=all  src
 1344  php-cs-fixer fix --dry-run src
 1345  php-cs-fixer fix src
 1346  php-cs-fixer fix src | grep sdb
 1347  php-cs-fixer fix src
 1348  sudo php-fixer self-update
 1349  sudo php-cs-fixer self-update
 1350  php-cs-fixer fix src
 1352  php-cs-fixer fix src
 1356  php-cs-fixer fix src
 1357  php-cs-fixer fix src --level=PSR2
 1358  php-cs-fixer fix src --level=psr2
 1424  php-cs-fixer