Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

On Linux (where pbcopy and pbpaste apparently don't exist), I've been using a bash function `cb` (to copy clipboard) and `cbf` (to copy a file to a clipboard) for years. If you install xclip on your system and add this to your .bashrc you can get it too: https://gist.github.com/FreedomBen/8d4d0a89fd39c8b5a5c4d5dcf...

Luckily I added a link to where I got it, because I had long forgotten. Thanks Nathan! Nathan's blog post is excellent and should be read: https://madebynathan.com/2011/10/04/a-nicer-way-to-use-xclip...



It's rather straightforward to create .bashrc aliases on Linux to transform xclip or xsel into pbcopy and pbpaste [0]:

  alias pbcopy='xclip -selection clipboard'
  alias pbpaste='xclip -selection clipboard -o'
[0] https://superuser.com/a/288333/72342




Consider applying for YC's Winter 2026 batch! Applications are open till Nov 10

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: