Powerful history command shortcuts in bash (#tilPost)

Ashley Williams tweeted that !! in commit messages will be replaced with the last executed command.
It turns out this is nothing git specific but rather command line specific and there are a lot more:

!! – last command
!1 – first e…


This content originally appeared on Stefan Judis Web Development and was authored by Stefan Judis

Ashley Williams tweeted that !! in commit messages will be replaced with the last executed command.

It turns out this is nothing git specific but rather command line specific and there are a lot more:

  • !! - last command
  • !1 - first entry in history
  • !-1 - last entry in history
  • !ssh - last command starting with ssh
  • !:1 - first argument of last command

For the case of git this works only when using -m though. ;) If you want to read more about this Digital Ocean published a nice article on this topic.


Reply to Stefan


This content originally appeared on Stefan Judis Web Development and was authored by Stefan Judis


Print Share Comment Cite Upload Translate Updates
APA

Stefan Judis | Sciencx (2017-03-20T23:00:00+00:00) Powerful history command shortcuts in bash (#tilPost). Retrieved from https://www.scien.cx/2017/03/20/powerful-history-command-shortcuts-in-bash-tilpost/

MLA
" » Powerful history command shortcuts in bash (#tilPost)." Stefan Judis | Sciencx - Monday March 20, 2017, https://www.scien.cx/2017/03/20/powerful-history-command-shortcuts-in-bash-tilpost/
HARVARD
Stefan Judis | Sciencx Monday March 20, 2017 » Powerful history command shortcuts in bash (#tilPost)., viewed ,<https://www.scien.cx/2017/03/20/powerful-history-command-shortcuts-in-bash-tilpost/>
VANCOUVER
Stefan Judis | Sciencx - » Powerful history command shortcuts in bash (#tilPost). [Internet]. [Accessed ]. Available from: https://www.scien.cx/2017/03/20/powerful-history-command-shortcuts-in-bash-tilpost/
CHICAGO
" » Powerful history command shortcuts in bash (#tilPost)." Stefan Judis | Sciencx - Accessed . https://www.scien.cx/2017/03/20/powerful-history-command-shortcuts-in-bash-tilpost/
IEEE
" » Powerful history command shortcuts in bash (#tilPost)." Stefan Judis | Sciencx [Online]. Available: https://www.scien.cx/2017/03/20/powerful-history-command-shortcuts-in-bash-tilpost/. [Accessed: ]
rf:citation
» Powerful history command shortcuts in bash (#tilPost) | Stefan Judis | Sciencx | https://www.scien.cx/2017/03/20/powerful-history-command-shortcuts-in-bash-tilpost/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.