Switch to another running application from terminal

Let's say I have opened Firefox Browser and Libre Office, and then I opened Terminal. Can I, from Terminal use a command to switch back to Firefox.?


Solution 1:

You can do it using wmctrl. To install it use in terminal,

sudo apt-get install wmctrl

To switch to firefox use the following command in terminal,

wmctrl -a firefox

Actually it switch to a window with name containing 'firefox' in it. see man wmctrl for more.