LoginSignup
88
52

More than 5 years have passed since last update.

コマンドラインからクリップボードへのコピー

Last updated at Posted at 2014-11-05

コマンドライン標準出力をクリップボードにコピーする方法

Mac OS Xでのクリップボードへのコピー

$ cat hoge.txt | pbcopy

Ubuntuでのクリップボードへのコピー

$ cat hoge.txt | xsel --clipboard --input

ちなみにUbuntuの場合はxselコマンドがインストールされていないと動かないのでインストールされていない場合はインストール

$ sudo apt-get install xsel

~/.bashrc にエイリアスを定義しておけばマックと同じように使えるので便利

alias pbcopy='xsel --clipboard --input'
88
52
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
88
52