Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Does nobody use grep?


How can you use grep to search the scrollback/screen buffer?


I don't want to presume your use case, but Ghostty has a command for dumping the buffer to a file, which I use for processing output "too late" to use grep.

keybind = ctrl+alt+shift+o=write_scrollback_file:open


Try a pager instead. Batcat is more feature rich but there's always the good old less (and more) command. Both work great with grep. I do things like the following multiple times a day

  $ cat foo.log | less
  $ cat foo.log | $PAGER
  $ cat foo.log | grep 09-23-2025 | less
Side note / pro tip: on a new line in the terminal press control-x control-e. If you're in zsh you need to edit your config but this will work out of the box for bash.


You can leave the cat at home.

  less foo.log
  grep 09-25-2025 foo.log | less



but he will feel lonely if he doesn't participate :(


Ghostty has a write_scrollback_file action you can use to write the scrollback to a temporary file. I have this set to cmd+shift+f, so I simply

less [cmd+shift+f] [enter]

You can use grep similarly.


What good is grep if you want to search the build log on your screen that took an hour in the making? Should have thought of tee-ing it, well duh.


You just rawdog that to stdout without a log file?


I do. Setting up log files for each and every command seems tedious. I would rather just cmd+f to search and have it work for everything, as it is a property of the terminal, rather than a specific command.


Of course. Why not? I can use the terminal's search facility to search its infinite scrollback buffer.


If I don't anticipate problems, or things are slower than I thought? Sure


"Do you not have phones?"




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: