LoginSignup
92
65

More than 5 years have passed since last update.

Macのpbcopyをubuntuでも使う

Posted at

Max OS では クリップボードにコピーするための pbcopy が使える

$ cat hoge.txt | pbcopy

この場合は、hoge.txtの内容がクリップボードにコピーされる

Ubuntuの場合は、xsel というものを使ってこの動きを模倣できる。
標準ではインストールされていないので、まずはインストールする必要がある。

$ sudo apt-get install xsel

出力をクリップボードにコピーするのは以下のコマンドでできる

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

いちいちこれを入力するのは面倒なので。.bashrcにエイリアスを定義しておく

$ alias pbcopy='xsel --clipboard --input'
92
65
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
92
65