Quick Tip: How to search a help message in the Linux terminal

Have you ever needed to reference a command line tool's capabilities only to find out there is no manual page and that only the -h (—help) option is available?

Normally, this isn't a problem, but -h doesn't let you search for strings the way man does. That means if you are trying to use a tool that is quite extensive, scrolling and sifting through the help option's results manually can be quite cumbersome.

The ffuf command is a good example of this, but this can be a problem for many other CLI tools out there.

Thankfully, I just found a quick and easy way to search these help messages, and I feel so silly for not thinking of it sooner.

All you need to do is pipe the output of the -h message you are trying to reference into something like less:

ffuf -h | less

Now, after typing backslash (/), you can search throughout the -h message without manually scrolling through the whole thing, similarly to how you might search through a manpage.

I'm sure there are other ways to achieve this same result. But this is the one I have found works for me and that I will be using going forward.

If you know an even better way to achieve this, or you have any other underrated Linux command line tips and tricks, feel free to let me know in the comments below.

Tags: #Tutorials Comments: Discuss...