> For the complete documentation index, see [llms.txt](https://til.yulrizka.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://til.yulrizka.com/osx/pipe-output-to-clipboard-with-pbcopy-and-pbpaste.md).

# pipe output to clipboard with pbcopy and pbpaste

Using terminal and needs to copy the result of command to clipboard ? use pbcopy

```bash
$ cat somefile.txt | pbcopy
```

Or the other way around, paste from clipboard and pipe it to other program

```bash
$ pbpaste | grep foo
```
