Showing posts with label Bash. Show all posts
Showing posts with label Bash. Show all posts

Friday, December 01, 2006

History tricks in Bash

  • ! ! - Last command
  • !n - Get the "n" th command
  • !-n - Get "-n" command from the current command
  • !str - Get the command which matches "str"
  • ^str1^str2 - Replace str1 by str2 for the last command

Wednesday, November 08, 2006

Bash - the fc command

fc is built-in shell command which you can use to check up on the most recent commands that you executed

So you do

fc -l -to list the last 16 commands that you entered

or

fc -l a -to list commands starting from any command starting with "a"

There are quite a few other options as well - try it out