I have a bash script where I configure my proxy settings automatically. I have created some aliases in the
.bash_aliases file. Now there is one command where I ssh into my remote server and do some dynamic port forwarding and essentially create a socks proxy. So I need to configure my proxy settings accordingly.
The command looks like:
proxy off && ssh -D <port> <username>@<hostaddress>
I have aliased the above command and when I type the alias in the terminal, I am connected to my remote server successfully. However after this is done, I need to run another command in a new terminal window to configure my newly created socks proxy. Basically I just need to run:
proxy socks #It configures my laptop to use the socks proxy
I can't do it in the same terminal window and just
&& it after the ssh command because that would mean I am trying to execute the command on the remote server. I want to run this command on my laptop.
Is there any way I can run the second command in a new terminal window in a single line like we pipe or and different commands? It's really inefficient to open a new tab in the terminal every time I ssh into my remote server, just so that I can type a single command to configure my proxy and then close that tab because I don't need it anymore.