{"id":1872,"date":"2019-08-12T20:09:11","date_gmt":"2019-08-12T11:09:11","guid":{"rendered":"https:\/\/yuis-programming.com\/?p=1872"},"modified":"2021-07-18T18:25:05","modified_gmt":"2021-07-18T09:25:05","slug":"bash%e3%82%b3%e3%83%9e%e3%83%b3%e3%83%89%e3%83%a9%e3%82%a4%e3%83%b3%e3%81%ae%e6%a8%99%e6%ba%96%e5%87%ba%e5%8a%9b%e3%82%92%e3%83%a4%e3%83%b3%e3%82%af%e3%81%a7%e9%81%b8%e6%8a%9e%e3%81%97%e3%81%a6","status":"publish","type":"post","link":"https:\/\/yuis-programming.com\/?p=1872","title":{"rendered":"Bash\u30b3\u30de\u30f3\u30c9\u30e9\u30a4\u30f3\u306e\u6a19\u6e96\u51fa\u529b\u3092\u30e4\u30f3\u30af\u3067\u9078\u629e\u3057\u3066\u30d1\u30a4\u30d7\u306b\u6e21\u3059"},"content":{"rendered":"<p>Linux Bash\u30b3\u30de\u30f3\u30c9\u30e9\u30a4\u30f3\u306e\u6a19\u6e96\u51fa\u529b\u3092\u30e4\u30f3\u30af\u3067\u9078\u629e\u3057\u3066\u30d1\u30a4\u30d7\u306b\u6e21\u3059\u65b9\u6cd5\u306b\u3064\u3044\u3066\u7d39\u4ecb\u3057\u307e\u3059\u3002<\/p>\n<p><img src=\"https:\/\/yuis.xsrv.jp\/images\/ss\/ShareX_ScreenShot_62286dd0-e782-411e-b087-2688dab38f2b.gif\" alt=\"https:\/\/yuis.xsrv.jp\/images\/ss\/ShareX_ScreenShot_62286dd0-e782-411e-b087-2688dab38f2b.gif\"><\/p>\n<p>\u6a19\u6e96\u51fa\u529b\u306e\u30c7\u30fc\u30bf\u304b\u3089\u30c7\u30fc\u30bf\u3092\u9078\u629e\u3057\u3066\u30d1\u30a4\u30d7\u306b\u6e21\u3059\u3053\u3068\u304c\u3067\u304d\u308b\u3001yank\u3092\u8a66\u3057\u3066\u307f\u307e\u3057\u305f\u3002<\/p>\n<p><a href=\"https:\/\/github.com\/mptre\/yank\">mptre\/yank: Yank terminal output to clipboard<\/a><\/p>\n<p>\u30d8\u30eb\u30d7<\/p>\n<pre><code>yuis ASUS \/mnt\/c\/pg$ yank-cli  --help\nyank-cli: invalid option -- '-'\nusage: yank [-lx | -v] [-d delim] [-g pattern [-i]] [-- command [argument ...]]\n<\/code><\/pre>\n<p><code>-d<\/code> &#8230; \u30c7\u30ea\u30df\u30bf\u3002 e.g. <code>yank -d \\\", &lt;file.csv<\/code><br \/>\n<code>-g<\/code> &#8230; \u6b63\u898f\u8868\u73fe  e.g. <code>ps ux | yank -g [0-9]+ | xargs kill<\/code><br \/>\n<code>-l<\/code> &#8230; \u884c\u3092\u9078\u629e ( \u3053\u308c\u306f<code>fzf<\/code>\u3068\u304b\u3067\u3082\u4ee3\u7528\u304c\u3067\u304d\u307e\u3059\u306d )<\/p>\n<p>\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb<\/p>\n<pre><code>sudo apt update ; sudo apt-get install yank\n<\/code><\/pre>\n<h2>\u4f7f\u7528\u4f8b<\/h2>\n<ul>\n<li>\u30d1\u30b9\u3092\u30e4\u30f3\u30af<\/li>\n<\/ul>\n<pre><code>echo $PATH | yank-cli -d :\n<\/code><\/pre>\n<p><img src=\"https:\/\/yuis.xsrv.jp\/images\/ss\/ShareX_ScreenShot_e31dce5a-a5ba-493d-ab76-23eff5cfcbd7.gif\" alt=\"https:\/\/yuis.xsrv.jp\/images\/ss\/ShareX_ScreenShot_e31dce5a-a5ba-493d-ab76-23eff5cfcbd7.gif\"><\/p>\n<ul>\n<li>\u30d7\u30ed\u30bb\u30b9PID\u3092\u30e4\u30f3\u30af<\/li>\n<\/ul>\n<pre><code>yuis ASUS \/mnt\/c\/_tmp\/20190604000330$ ps aux | head\nUSER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND\nroot         1  0.0  0.0   8324   116 ?        Ss   May16   0:00 \/init\nroot         3  0.0  0.0   8340    80 tty1     Ss   May16   0:00 \/init\nyuis         4  0.0  0.0  36296   284 tty1     Sl   May16   0:00 \/mnt\/c\/Program Files\/ConEmu\/ConEmu\/w\n\n<\/code><\/pre>\n<pre><code>ps aux | head | yank-cli\n<\/code><\/pre>\n<p><img src=\"https:\/\/yuis.xsrv.jp\/images\/ss\/ShareX_ScreenShot_62286dd0-e782-411e-b087-2688dab38f2b.gif\" alt=\"https:\/\/yuis.xsrv.jp\/images\/ss\/ShareX_ScreenShot_62286dd0-e782-411e-b087-2688dab38f2b.gif\"><\/p>\n<ul>\n<li>\u6a19\u6e96\u51fa\u529b\u306b\u6e21\u3059<\/li>\n<\/ul>\n<pre><code>ps aux | head | yank-cli | tee\n<\/code><\/pre>\n<p><img src=\"https:\/\/yuis.xsrv.jp\/images\/ss\/ShareX_ScreenShot_10f4c85a-b50d-4155-8215-ded5bbc97397.gif\" alt=\"https:\/\/yuis.xsrv.jp\/images\/ss\/ShareX_ScreenShot_10f4c85a-b50d-4155-8215-ded5bbc97397.gif\"><\/p>\n<ul>\n<li>WSL bash\u3067\u4f7f\u3046<\/li>\n<\/ul>\n<pre><code>ps aux | head | yank-cli -- clip.exe\n\n# or\n\nps aux | head | yank-cli | clip.exe\n<\/code><\/pre>\n<blockquote><p>\n  If stdout is not a terminal the selected field will be written to stdout and exit without invoking the yank command.<\/p><\/blockquote>\n<p>\u307e\u3041\u3064\u307e\u308ayank\u30b3\u30de\u30f3\u30c9\u306e\u3042\u3068\u306b\u30d1\u30a4\u30d7\u304c\u3042\u308c\u3070\u305d\u308c\u306b\u30d1\u30a4\u30d7\u3092\u3057\u3066\u3001\u306a\u3051\u308c\u3070\u30af\u30ea\u30c3\u30d7\u30dc\u30fc\u30c9\u306b\u30b3\u30d4\u30fc\u3059\u308b\u64cd\u4f5c\u3092\u3059\u308b\u3001\u3068\u3044\u3046\u3053\u3068\u3067\u3059\u306d\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Linux Bash\u30b3\u30de\u30f3\u30c9\u30e9\u30a4\u30f3\u306e\u6a19\u6e96\u51fa\u529b\u3092\u30e4\u30f3\u30af\u3067\u9078\u629e\u3057\u3066\u30d1\u30a4\u30d7\u306b\u6e21\u3059\u65b9\u6cd5\u306b\u3064\u3044\u3066\u7d39\u4ecb\u3057\u307e\u3059\u3002 \u6a19\u6e96\u51fa\u529b\u306e [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"spay_email":"","jetpack_publicize_message":"","jetpack_is_tweetstorm":false},"categories":[1],"tags":[],"acf":[],"jetpack_featured_media_url":"","jetpack_publicize_connections":[],"jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p8Rxwo-uc","_links":{"self":[{"href":"https:\/\/yuis-programming.com\/index.php?rest_route=\/wp\/v2\/posts\/1872"}],"collection":[{"href":"https:\/\/yuis-programming.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/yuis-programming.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/yuis-programming.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/yuis-programming.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1872"}],"version-history":[{"count":3,"href":"https:\/\/yuis-programming.com\/index.php?rest_route=\/wp\/v2\/posts\/1872\/revisions"}],"predecessor-version":[{"id":2605,"href":"https:\/\/yuis-programming.com\/index.php?rest_route=\/wp\/v2\/posts\/1872\/revisions\/2605"}],"wp:attachment":[{"href":"https:\/\/yuis-programming.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1872"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/yuis-programming.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1872"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/yuis-programming.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1872"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}