Shell Command in knime

Hello all Knimian,

I want to run a shell command in a loop. Can anyone suggest me any workflow or Nodes to use this purpose !!! urgently needed alll....


Im using a java snippet for simple shell calls, e.g. like (here windows/linux version):

boolean isWindows=c_knimework.charAt(0)!='/';


String call="some call from somewhere";

ProcessBuilder pb =null;
if (isWindows){
        //modify for windows if needed
 pb = new ProcessBuilder("cmd","/C",call);}
       //modify for linux if needed
 pb = new ProcessBuilder("bash","-c",call);
        try {
            Process p = pb.start();
            String s;
            // read from the process's combined stdout & stderr
            BufferedReader stdout = new BufferedReader(
                new InputStreamReader(p.getInputStream()));
            while ((s = stdout.readLine()) != null) {
            out_ResultCode= p.waitFor();
        } catch (Exception ex) {
out_Call = call;



What about the External Tool Node?

1 Like



There is a BASH node in the NGS node collection. Maybe that helps?

We generated a CSH node for our internal systems, but at the end it is based on the above mentioned BASH node.

But be careful when using these node. Normally they just work in a very specific setup within your infrastructure. That can just be a workaround.




For Superfast Reply!!!


For me the external toolnode always had the problem that it expected some input/output files. Just calling some commands didnt seem possible without any weird hacks. Generating some XML/XLS files (to be used together with a reader node for this file format) is not possible this way either.


that sounds interesting. As its called "bash"-node... is it supporting windows too by any chance? Choosing a linux KNIME server with windows clients complicates things unfortunately. 

Please add java snippet node in knime process(knwf)).
Because I have never used java snippet node before.

Hi there @omeralitopal,

are you interested about using Java Snippet for shell command in KNIME?

To check workflow examples of Java Snippet check its description on KNIME Hub. At bottom you will find them listed.


are you interested about using Java Snippet for shell command in KNIME? >> Yes, exactly

I check this article but please how to write shell script using java sinppet example. Because I have never used java snippet node before. Thanks

You can also try the Bash node to invoke an external shell. Others here on the forum have had success with that in the past.

1 Like

Hi @omeralitopal,

you are proficient in Java or? Anyways I would follow @ScottF advice :wink: