DEV Community

Gaurav Purswani
Gaurav Purswani

Posted on

how to execute commands from another terminals by being on just one terminal

A)OPEN TERMINAL FROM TERMINAL

1.gnome-terminal

--terminal command to open terminal .

2.gnome-terminal -e [command]

--terminal command to open terminal and execute command in new terminal

3.gnome-terminal --command="bash -c '[command1]; [command2]; $SHELL'"

--bash -c tells it is a bash command
--command1 and command2 are commands to be executed on new terminal.
--$SHELL makes the terminal remain open to work on.

4.gnome-terminal --tab

--opens a new tab in the same terminal.

Top comments (2)

Collapse
 
prashantnirgun profile image
Prashant Nirgun

I am using Ubuntu 18.04.4 LTS and using the following command

gnome-terminal --tab --title="Dev Server" --command="bash -c 'pwd; $SHELL'"

its showing --command is showing warning
Use โ€œ-- โ€ to terminate the options and put the command line to execute after it.

Collapse
 
gauravpurswani profile image
Gaurav Purswani

I'll be posting exiting things that we can Do in Linux