Skip to content

Instantly share code, notes, and snippets.

@ryanhanwu
Created September 29, 2012 16:26
Show Gist options
  • Select an option

  • Save ryanhanwu/3804510 to your computer and use it in GitHub Desktop.

Select an option

Save ryanhanwu/3804510 to your computer and use it in GitHub Desktop.
Bash Tip
#replace previous command str1 to str 2
^str1^str2^
or
!!:gs/str1/str2/
# execute the most recent command the contains the following string:
!?ncm
cp /usr/local/etc/apache/file1.txt /usr/local/etc/apache/file2.txt
#you can grap and reuse that prefix. It's named !#:1:h like:
cp /usr/local/etc/apache/file1.txt !#:1:h/file2.txt !#:1:h/file3.txt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment