Saturday, November 10, 2012

pbpaste & pbcopy in Linux

People who are using Mac OS X Terminal may will use these two useful commands: pbcopy & pbpaste, with them you could access your clipboard from the command line.

Recently, I've switched to Linux Mint from Mountain Lion, and I didn't find any alternatives to these two commands, but I found a closet way to implement them: xclip




xclip, you can say it is the clipboard for command line, but the best thing is, it could access the system clipboard in your desktop environment, so I decided to make two command by alias, and make them works just like on Mac OS X.

alias pbcopy="xclip -selection clipboard -i"
alias pbpaste="xclip -selection clipboard -o"

xclip with -i option will receive input from stdin, and store them in your selection(in here, it's clipboard).

xclip with -o option do output the string you just stored in the selection(clipboard).

So, that's it, they works just like under Mac OS X.

Monday, November 5, 2012

Problem of "Mac OS applications didn't remember your password anymore"a

After upgrading to Mountain Lion, I encountered a problem that every applications those requires user to login couldn't remember the password I entered, selecting "Remember me" or "Automatically login" is not working.

I installed my Mac OS X via clean install, I didn't why I encountered this problem, maybe it caused by existing two version of Mac OS X in my Macbook.

At first, I tried to delete all keychains in the login keychain, so I opened "Keychain Access", and switched to "Login keychain", selected and ready to delete all the items in login keychain, but failed.

it seems like the keychain items have the wrong keychain format, so we need to delete keychain items manually.

the keychain files is located at ~/Library/Keychains

Just follow the instructions:

  1. open your terminal
  2. cd ~/Library/Keychains
  3. rm login.keychain
  4. randomly open a program which require login to use like Evernote, logout and login, you will see the request to "reset login keychain to default", select "Yes", now everything about password storage will work like a charm.
Cool.