Skip to content

Instantly share code, notes, and snippets.

@rubencabrera
Last active September 18, 2019 13:58
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rubencabrera/dc461de1a0cf9bd1dc3e1bbca23b8bbc to your computer and use it in GitHub Desktop.
Save rubencabrera/dc461de1a0cf9bd1dc3e1bbca23b8bbc to your computer and use it in GitHub Desktop.
Xclip aliases (requires xclip installed)
#! /bin/bash
echo 'alias "c=xclip"' >> ~/.bashrc
echo 'alias "v=xclip -o"' >> ~/.bashrc
echo 'alias "cs=xclip -selection clipboard"' >> ~/.bashrc
echo 'alias "vs=xclip -o -selection clipboard"' >> ~/.bashrc
@rubencabrera
Copy link
Author

Bash aliases to handle clipboard

@rubencabrera
Copy link
Author

For example, if you want the output of a command (e.g. echo) to be copied to your selection clipboard (the one you paste using Ctrl+V), you can do:

echo "the output of a command" | cs

To get what's on your selection clipboard (things you copied with Ctrl+C) and pipe it to a command (e.g. base64):

vs | base64

@stuart-warren
Copy link

pbcopy/pbpaste can be used for the same sort of thing on mac

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment