Customization of CMDLINE output in column "Command"
The contents of column "Command" is apparently the contents of /proc/PID/cmdline with some modifications made by code in Process.c. It would be great if this could be even more customizable in a content specific way. For instance when using java in most cases there is a very long classpath so one cannot see what class is actually executed, because it is printed last. You only know that some java proc is running. Or when using julia some file.jl is being executed. In the cmdline the absolute path of file.jl is given and with a long path in some (my...) cases "file.jl" isn't visable so you cannot see what is actually executed
An idea could be to hide (->settings)
- all short options ( -t)
- all long options (--time-to-live)
- strip pathnames in general (not only for the executable)
Maybe in combination with a "guard"
- if julia then strip pathnames
Or some sort of plugin-code?
htop currently does not filter anything from the path; everything is kept visible (the only part where things are hidden, that hiding is simplifying the display). For a feature like you suggest, htop would need to have a close look at the arguments and partially interpret those. As this has to depend on the process it would go down a very deep rabbit hole which I'm not convinced, we should do.
Things that could be done is shortening any path-like arguments to just f/b/b/quo.class instead of foo/bar/baz/quo.class. This could be done without context and might already alleviate the situation you are describing.
Thanks for the quick response :-)
You are right: It's not only the option itself (-classpath) I want to hide in the display but the argument of this option too (the actual classpath). So the cmdline has to be interpretated which is context dependent. Hmmm. Maybe it can be done using user-defined regex to hide components of the cmdline in the display?
Your shortening suggestion would already help a lot. It is imho better than skipping the path completely because you have some hint that there was manipulation done and the information left can be valuable in some cases.
@Para7etamol How about as a workaround, you use the "filter" feature to grab the strings you want from the command line? It doesn't support regex yet (AFAIK) but it could help you with your situation.
Currently htop does not use any regexp anywhere. It's really a hard sell to add them just for this feature …