justpath to explore PATH quickly

epogrebnyak

I always get the feeling that nobody knows what a PATH is and at this point they are too afraid to ask.

In those rare cases you want see what kind of a mess your PATH variable is, what tools can you use? Print to screen with bash, split by line, maybe sort for visibility, inspect specific set of folders. What is you wanted to do the same on Windows, do you have to remember which operating system has which separator on PATH? Also are there duplicates or non-existing directories on PATH?

For this set of questions I wrote a small utility in Python for exploring and correcting the PATH. Correcting - bit in a correct sense - that is generating a new PATH string that you may use at shell startup script or with an environment manager.

The basic commands are the following:

justpath --raw
justpath
justpath --count
justpath --invalid
justpath --duplicates
justpath --purge-invalid --purge-duplicates
justpath --clean --string

The project is located at https://github.com/epogrebnyak/justpath. Hope it is useful next time you will need to have a look at your PATH.