Ubuntu – GUI to CLI command translator

bashcommand lineguiunity

Is there any application (or sequence of commands) for this function: seeing the result of the actions, while using a GUI interface, being automatically translated into a Terminal (or similar CLI environment) on the same machine.

I saw this in action long years ago in VBA for Applications (for example the Macros in Excel). I wonder if there is same function in Linux.

Best Answer

GUI actions often have no external replament

There is no general possibility to "listen" to GUI actions, and translate them directly to cli equivalents. On Linux nor on Windows.
In general only a small selection of the GUI actions is to be controlled by cli at all. The developer of the software in question will make a decision on what actions he or she thinks are useful to make available as a command "from outside", and we depend on API's, or those cli options the developer made available. Most of these commands, you will usually find in the man pages of an application. type:

man <application>

This does not mean we are totally helpless if no command is available, and to be able to control many things on our box, we have numerous tools, to at least "listen" to what happens, and replace the processes inside the application by our own designed commands, or our own scripted solutions.

What tool is useful in your case totally depends on the action you'd like to simulate. We'd need an additional question to point you in the right direction.

One (random, but extremely useful in many situations) option I'd like to mention though:

  • If we open a terminal, and run:

    dconf watch /

    We can exactly see what dconf/gsettings keys the (any) application is playing with, and we can directly run gsettings commands to do the same. With this command, we can practically see all actions different tweak tools apply.

Furthermore, many script languages have very powerful tools to control both hardware and edit files directly, but as mentioned, we'd need a more specific example to help you further with that.


Another option you have, if you are more or less familiar with coding, is to look into the source code of the application. Especially interpreted languages will often be quite readable, to give you useful information.