I am looking for method to check which jenkins plugins are not used. So far I found that I can look for tags in config.xml file with attribute plugin then comp
Some plugins only affect the Jenkins system configuration, rather than individual jobs; you should be able to find those by changing the find method in your code to include /home/user/.jenkins/config.xml.
Many plugins have their own configuration files in $JENKINS_HOME, e.g. $JENKINS_HOME/org.jenkinsci.plugins.p4.PerforceScm.xml. I haven't looked into this, but your might be able to find some extra plugin usage by searching the config.xml files for the plugin name (e.g. PerforceSCM) rather than the term "plugin".
Also, if you only want to search for jobs that are enabled, you can filter out jobs with "<disabled>true</disabled>"
in their config.xml.
If you need to check the list of installed but disabled plugins you can check Installed tab in plugin manager.
Unchecked are the ones that are disabled.
There's a Jenkins plugin precisely for this matter: Plugin Usage
Thanks to this wonderful plugin I found many redundant plugins to remove in the Plugin Manager (you will be able to remove plugins that has no dependencies).
Here's how it looks - the plugin interface has a link on Jenkins sidebar. It lists all the plugins which any of an existing job uses (pressing on the expand button to see jobs names):