LoginSignup
20
20

More than 5 years have passed since last update.

peco でプロセスを選んで reptyr で pty を付け替える

Posted at

reptyr が便利すぎるので peco からプロセスを選んで使えるようにしてみました。

function reattach-pty {
    local process=$(ps aux | grep "^$USER" | peco | awk '{print $2}')
    [[ -n "$process" ]] && reptyr "$process"
}

この関数を .zshrc などに書いておいて、ターミナルから reattach-pty と打つと、peco が起動してプロセスの一覧が見れます。
その中からひとつを選ぶと、reptyr されます。
何も選ばずに peco を終了した場合は何もしません。

参考

20
20
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
20
20