Improve your code searching skills with pss

Searching a code base is a part of every day developer activities. From fixing a bug, to learning a new code base or checking how to call an api, being able to quickly navigate your way into a code base is a great skill to have. Luckily, we have dedicated tools to search code. Let’s see how to install and use one of them – pss.

What is pss?

pss is a command line tool that helps searching inside source code file.  pss searches recursively within a directory tree, knows which extensions and file names to search and which to ignore, automatically skips directories you wouldn’t want to search in (for example




), colors its output in a helpful way, and much more.

Installing pss

Install pss on Fedora with the following command:

 $ dnf install pss

Once the installation is complete you can now call pss in your terminal

 $ pss

Calling pss without any argument or with the -h flag will print a detailed usage message.

Usage examples

Now that you have installed pss let’s go through some Usage examples.

 $ pss foo

This command simply looks for


. You can be more restrictive and ask pss to look for


only in python files:

 $ pss foo --py

and for


in all other files:

 $ pss bar --nopy

Additionally, pss supports most of the well known source file types, to get the full list execute:

$ pss --help-types

You can also ignore some directories. Note that by default, pss will ignore directories like .git, __pycache__, .metadata and more.

$ pss foo --py --ignore-dir=dist

Furthermore, pss also gives you the possibility to get more context from your search using the following :

$ pss -A 5 foo

will display 5 line of context after the matching word

$ pss -B 5 foo

will display 5 line of context before the matching word

$ pss -C 5 foo

will display 5 line of context before & after the matching word

If you would like to learn how to use  pss  with regular expression and other options, more examples are available here.

Using Software


  1. Joao Rodrigues

    So… it’s like grep

    $ dnf install pss
    $ dnf install grep (no need to install grep; it’s already installed)

    $ pss (or $ pss -h)
    $ man grep ( or $ info grep)

    $ pss foo
    $ grep -nR foo .

    $ pss foo –py
    $ grep -nR –include=’*.py’ .

    $ pss foo –nopy
    $ grep -nR –exclude=’*.py’ .

    $ pss foo –py –ignore-dir=dist
    $ grep -nR –include=’*.py’ –exclude-dir=dist .

    $ pss -A 5 foo
    $ grep -A 5 -nR foo .

    • Hi Joao,

      Indeed it very similar to grep, and also inspired by ack. One of the extra feature is that pss will nicely format the output making it easy to interpret the search result.

      Luckily for developers there is a great choice of tools available to search code. The link below lists some of the more popular.

      • Cody

        And since it’s in Python it’ll be a lot slower too, yes? Of course I don’t have an example of the formatting but one can do that with other tools too (and as for git there is

        git grep


        Not saying this tool is useless but the examples shown here are nothing


        can’t do and it’s quite similar too (as someone else showed; I was going to say the same only I wasn’t first).

        Just a suggestion: show something that can’t be done in


        or that is done much more easily than with


        ? Would give people a better idea as to why it might be adopted (although I suspect many old timers will never go for it in the long run – I include myself in that group – there are many who might actually appreciate it but only if they can see its power).

        • Cody

          Seems I messed up the formatting too. Maybe you can fix it? Not even sure what triggered that (I suppose something to do with the grave accent but I don’t know for sure as I don’t have what I actually typed).

  2. Guus Bonnema

    Pss seems almost identical to ack. However, it has no man page. For me manpages are a lifesaver while developing. This looks like a serious bug to me.

    Will pss ever have a non-trivial manpage, describing its functions, options and error codes?

  3. Robert

    Looks nice, but I just use my text editor such as Atom, Sublime Text, Visual Code, etc

  4. For anyone wanting something similar to pss, but extremely fast (even faster than grep in most cases), I’d like to recommend ripgrep (a.k.a.



    Available in the ripgrep package from the rust-sig repo on Fedora.

  5. Stephen Hill

    Reading the title I had hoped it was more like an evolution of cscope or the GNU “ID utilities” ( ).

    Personally I found cscope to be just as vital as air in working on a very large project for many years. I had hoped to find something like that for home use on Linux ( cscope was not free at the time, though I could have “borrowed” the source ) and eventually found the ID utils. It was not nearly as friendly as cscope, but still useful to me.

    The pss tool sounds like it would be useful too, if you don’t have things like cscope or idutils installed.

  6. Nauris

    I work for a software company almost 18 years. Worked with tons of code and different compilers. Today I just smile when a developer asks me to install 16GB of RAM on his computer just to get Visual Studio working. However, I’m wondering does somebody nowadays still writes his code on terminal and stores source code locally in directory structure? Graphical IDE just has so much advantages to be more productive on daily basis.
    I understand that sometimes you have to connect to a remote server and build something on specific HW/kernel and it may require patching code directly, however even so, there is a text mode tools for that, so you don’t have to grep or pss anything.
    Or am I just another windows nerd? 😀

    • Graphical IDE just has so much advantages to be more productive on daily basis.

      If that’s how you work, sure. For many many many of us, working with command line tools is much more powerful.

  7. Comparing




    (two competitors to


    ), I think I still prefer



    It’s written in C, with performance in mind. And it is, incredibly, fast.
    And the killer argument: “the command name is 33% shorter than ack” 😀

  8. Jeff C

    another old but powerful tool is cscope, which is more language-aware for c/c++ projects. It feels fairly old but is more powerful than just regex searching

Comments are Closed

The opinions expressed on this website are those of each author, not of the author's employer or of Red Hat. Fedora Magazine aspires to publish all content under a Creative Commons license but may not be able to do so in all cases. You are responsible for ensuring that you have the necessary permission to reuse any work on this site. The Fedora logo is a trademark of Red Hat, Inc. Terms and Conditions