Raymii.org

submited by
Style Pass
2021-05-23 22:00:17

This is a small tip I want to give you when using a less based pager, for example in journalctl or when viewing a file interactively with less or more. You can exclude certain lines that match one or multiple words (or a regex) with a few keystrokes, once less is open. This is one of those tips you never knew you needed, but when you know it, you'll use it frequently. Like in my case today when searching through some logfiles to find out why my database stopped working.

Consider sponsoring me on Github. It means the world to me if you show your appreciation and you'll help pay the server costs. You can also sponsor me by getting a Digital Ocean VPS. With this referral link you'll get $100 credit for 60 days.

Ampersand opens the pattern matching mode, exclamation mark tells less to exclude the following part, and then you enter your search term.

I was troubleshooting why my RSS reader (miniflux) stopped working, it gave an error telling me it couldn't connect to the database. Turns out the VPS had run out of memory a day earlier and the database was hit by the out-of-memory (OOM) killer. By excluding all irrelevant stuff I was able to figure out really quickly what the actual error was:

Leave a Comment
Related Posts