{"id":13438152,"url":"https://github.com/mptre/yank","last_synced_at":"2025-05-15T14:04:23.045Z","repository":{"id":39917540,"uuid":"41288520","full_name":"mptre/yank","owner":"mptre","description":"Yank terminal output to clipboard","archived":false,"fork":false,"pushed_at":"2022-10-02T16:06:42.000Z","size":146,"stargazers_count":1649,"open_issues_count":2,"forks_count":47,"subscribers_count":23,"default_branch":"master","last_synced_at":"2025-04-15T03:48:46.156Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mptre.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-08-24T07:23:17.000Z","updated_at":"2025-04-10T10:11:50.000Z","dependencies_parsed_at":"2022-07-19T08:29:48.179Z","dependency_job_id":null,"html_url":"https://github.com/mptre/yank","commit_stats":null,"previous_names":[],"tags_count":23,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mptre%2Fyank","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mptre%2Fyank/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mptre%2Fyank/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mptre%2Fyank/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mptre","download_url":"https://codeload.github.com/mptre/yank/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254355334,"owners_count":22057354,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-07-31T03:01:03.269Z","updated_at":"2025-05-15T14:04:22.998Z","avatar_url":"https://github.com/mptre.png","language":"C","readme":"# yank\n\nYank terminal output to clipboard.\n\n![yank](https://raw.githubusercontent.com/mptre/yank/gh-pages/screencast.gif)\n\n## Description\n\nThe\n[yank(1)][yank]\nutility reads input from `stdin` and display a selection interface that allows a\nfield to be selected and copied to the clipboard.\nFields are either recognized by a regular expression using the `-g` option or by\nsplitting the input on a delimiter sequence using the `-d` option.\n\nUsing the arrow keys will move the selected field.\nThe interface supports several Emacs and Vi like key bindings,\nconsult the man page for further reference.\nPressing the return key will invoke the yank command and write the selected\nfield to its `stdin`.\nThe yank command defaults to\n[xsel(1)][xsel]\nbut could be anything that accepts input on `stdin`.\nWhen invoking yank,\neverything supplied after the `--` option will be used as the yank command,\nsee examples below.\n\n## Motivation\n\nOthers including myself consider it a cache miss when resort to using the mouse.\nCopying output from the terminal is still one of the few cases where I still use\nthe mouse.\nSeveral terminal multiplexers solves this issue,\nhowever I don't want to be required to use a multiplexer but instead use a\nterminal agnostic solution.\n\n## Examples\n\n- Yank an environment variable key or value:\n\n  ```sh\n  $ env | yank -d =\n  ```\n\n- Yank a field from a CSV file:\n\n  ```sh\n  $ yank -d \\\", \u003cfile.csv\n  ```\n\n- Yank a whole line using the `-l` option:\n\n  ```sh\n  $ make 2\u003e\u00261 | yank -l\n  ```\n\n- If `stdout` is not a terminal the selected field will be written to `stdout`\n  and exit without invoking the yank command.\n  Kill the selected PID:\n\n  ```sh\n  $ ps ux | yank -g [0-9]+ | xargs kill\n  ```\n\n- Yank the selected field to the clipboard as opposed of the default primary\n  clipboard:\n\n  ```sh\n  $ yank -- xsel -b\n  ```\n\n## Installation\n\n### Arch Linux\n\n```sh\n$ pacman -S yank\n```\n\n### Debian\n\n```sh\n$ sudo apt-get install yank\n```\n\nThe binary is installed at `/usr/bin/yank-cli` due to a naming conflict.\n\n### Fedora\n\nVersions 24/25/26/Rawhide:\n\n```sh\n$ sudo dnf install yank\n```\n\nThe binary is installed at `/usr/bin/yank-cli` due to a naming conflict.\nMan-pages are available as both `yank` and `yank-cli`.\n\n### Nix/NixOS\n\n```sh\n$ nix-env -i yank\n```\n\n### openSUSE\n\n```\n$ zypper install yank\n```\n\n### macOS via Homebrew\n\n```sh\n$ brew install yank\n```\n\n### macOS via MacPorts\n\n```sh\n$ sudo port install yank\n```\n\n### FreeBSD\n\n```sh\n$ pkg install yank\n```\n\n### OpenBSD\n\n```sh\n$ pkg_add yank\n```\n\n### From source\n\nThe install directory defaults to `/usr/local`:\n\n```sh\n$ make install\n```\n\nChange the install directory using the `PREFIX` variable:\n\n```sh\n$ make PREFIX=DIR install\n```\n\nThe default yank command can be defined using the `YANKCMD` variable.\nFor instance,\nmacOS users would prefer `pbcopy(1)`:\n\n```sh\n$ make YANKCMD=pbcopy\n```\n\n## License\n\nCopyright (c) 2015-2022 Anton Lindqvist.\nDistributed under the MIT license.\n\n[xsel]: http://www.vergenet.net/~conrad/software/xsel/\n[yank]: https://www.basename.se/yank/\n","funding_links":[],"categories":["C","Utilities","Productivity","Tools","\u003ca name=\"copy-paste\"\u003e\u003c/a\u003eCopy/paste and clipboard","Other","\\*nix/\\*nux"],"sub_categories":["System Interaction Utilities","Kubernetes","C","Terminal"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmptre%2Fyank","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmptre%2Fyank","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmptre%2Fyank/lists"}