DEV Community

Discussion on: 3 Terminal Commands to Increase Your Productivity

Collapse
 
goodevilgenius profile image
Dan Jones

For a good Linux alternative to pbcopy and pbpaste, try out xclip.

grep text file.txt | xclip -i # copies into primary selection

grep text file.txt | xclip -i -sel clip # copies into clipboard

xclip -o # prints primary selection
xclip -o -sel clip # prints clipboard, like pbpaste

# highlight a selection of text, you don't need to Ctrl-c, just highlight
xclip -o > out.txt # pastes that selection into a file
Enter fullscreen mode Exit fullscreen mode

And if you're using Termux on Android, termux-clipboard-get and termux-clipboard-set give you access to the Android clipboard.