Need to copy something to the clipboard from the terminal?
Here it is, :
cat the-thing-you-want-to-copy | pbcopy
and in the form that I seem to use the most
cat ~/.ssh/id_rsa.pub | pbcopy
Remember this day. That’s all I can say.
This is just a quick note regarding some useful commands if you are a Mac User who uses their Mac for development.
Sometimes you want to get to a file, or see if one was created, but you can’t because the file in question is prefixed with a ‘.’ (e.g. .keystore, .profile, etc…). I personally ran into this when I was having to create https keys, which creates a .keystore file. I needed to find the file to confirm it was created, but I couldn’t until I stumbled across these nifty commands.
To see all files on your system, even the private ones, go to a command line and type:
defaults write com.apple.finder AppleShowAllFiles -bool true
Then to see the files you will need to re-launch finder, but since you are on the command line just go ahead and enter this command:
This command re-launches finder and all the items are now visible.
To return Finder to it’s previous state, of not showing all the files, go to the command line and type:
defaults write com.apple.finder AppleShowAllFiles -bool false
Then re-launch Finder with ‘killall Finder’.
I recommend this last step so that you don’t have to stare at all the ‘.DStore’ files and to keep you from accidentally doing something bad to your Mac.