Is there any method to interact with a program directly from the commmand line?

For example, I've a program, data.o, which produces a file mydata.out and then I want to plot it with gnuplot.

I can open the plotting program with gnuplot & and then I would like the shell to write somehow in this job/background shell I just opened plot mydata.out. (gnuplot is just an example, the question would be similar for executing some Macros or Hotkeys in every program I can open from the command line without leaving it).

  • you should google about inter-process communication. and also u should go down in programming in linux to understand that ur question is crude.
    – Necktwi
    Jun 26, 2013 at 9:27

2 Answers 2

  • some programs like gnuplot accept a command file, it may be easier to generate on and then pass it as argument.

  • some programs don't depend on interaction, for them piping to stdin may work

        printf "my command\n"
        printf "my other command line\n"
    ) | theProgram and its args
  • other depend on interaction and mandate that their standard input is a terminal, you have to use expect or equivalent.


programs or services that implement d-bus can be interacted from command line or from any other process. https://developer.gnome.org/gio/2.29/gdbus.html and googling about it should give you insight about inter-process communication.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .