From c904cb7d42e2519bc4e2ba59c60b434d66413013 Mon Sep 17 00:00:00 2001 From: Nils Winkler Date: Thu, 30 Oct 2014 14:31:55 +0100 Subject: [PATCH] Added alias for copying the last command to the OS X clipboard. Use `copyLastCmd` to copy the last executed command to the clipboard. --- aliases/available/osx.aliases.bash | 3 +++ 1 file changed, 3 insertions(+) diff --git a/aliases/available/osx.aliases.bash b/aliases/available/osx.aliases.bash index 299707ef..79ae9c48 100644 --- a/aliases/available/osx.aliases.bash +++ b/aliases/available/osx.aliases.bash @@ -38,3 +38,6 @@ alias flush='dscacheutil -flushcache' # Show/hide hidden files (for Mac OS X Mavericks) alias showhidden="defaults write com.apple.finder AppleShowAllFiles TRUE" alias hidehidden="defaults write com.apple.finder AppleShowAllFiles FALSE" + +# From http://apple.stackexchange.com/questions/110343/copy-last-command-in-terminal +alias copyLastCmd='fc -ln -1 | awk '\''{$1=$1}1'\'' ORS='\'''\'' | pbcopy'