LoginSignup
1
0

More than 3 years have passed since last update.

[bash] コマンド履歴を一気にコピペする方法

Posted at

history で見るとコマンドの番号が入ってそのままではコピペに使えなくてめんどくさい。
調べたら簡単なコマンドでできたのでメモ

https://qiita.com/catfist/items/82ed3df7a0b524aeab69
を参考にしました

history_pbcopy
history | tail -n (何個まえまで見たいか) | cut -d ' ' -f 5- | pbcopy

で取れます。便利!!!

ここからここまでって決まっていたら、

history_pbcopy
history | tail -n (何個まえまで見たいか) | head -n (そこから何個まで見たいか) | cut -d ' ' -f 5- | pbcopy

で取ることができます

1
0
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
1
0