I do not know if AskUbuntu is the correct place to ask or Stack Overflow.

To execute a statement in Windows use : C:\\Windows\\System32\\cmd.exe What is the equivalent in Ubuntu? I thought it was : /bin/bash but that does not work for me. I tried /bin/sh and /bin/dash ( like shown here )but without result.

In Virtualbox client I want to be able to execute a statement. For this I use pyvbox which is a Python shell for the virtualbox API.

After installing execute in statement in Virtualbox Windows client is possible with the statement :

process, stdout, stderr = gs.execute('C:\\Windows\\System32\\cmd.exe', ['/C', 'tasklist'])

See this link

I want to something like this for VBox Ubuntu client with the statement :

process, stdout, stderr = gs.execute('/bin/bash',['echo hello world'])

which returns no output.

In VBox Ubuntu client statement :

which bash

returns :


And echo hello world is executed well.

Which alternatives there might be to execute a statement in Ubuntu? Sorry if this is not the correct place to ask.


man bash

... i.e. try to adapt your code to bash -c 'echo Hello!'

Need to know more about bash?

http://tldp.org has at least two guides om bash - they will take you from a novice to an advanced level.

  • Thanks. I tried which raised an exception : 'Specified file was not found on guest' – Bernard Jul 11 '14 at 13:08
  • I interpret that as a problem caused by pyvbox - try process, stdout, stderr = gs.execute('/bin/bash',['-c echo hello world']) or something similar, I suspect the first arg must be kept as is. The bare bash -c call above works. Try it out. – Hannu Jul 11 '14 at 13:12
  • @Hanna. Very warm. Your suggestion did not work. But process, stdout, stderr = gs.execute('/bin/bash',['-c', 'echo hello world']) did. Thanks very much. – Bernard Jul 11 '14 at 13:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.