3

Is there a way I can input these two commands into a new terminal at the same time?

( konsole -e sudo nethogs 
sudo sysctl net.ipv4.ip_forward=1 )
1
  • 1
    Could you add some more context? What are you trying to accomplish by running these commands "at the same time"?
    – Zchpyvr
    Apr 8, 2019 at 19:53

2 Answers 2

5

I think what you want to do with konsole is the following:

$ konsole -e "sudo sysctl net.ipv4.ip_forward=1; sudo nethogs" --noclose --hold

This will invoke konsole and then run commands within it, -e. In this case we're running the 2 sudo commands and we're using the --noclose & --hold to tell konsole to keep the window open while these run.

7
  • root@MO-HP-EliteBook-8560p:/home/mo# konsole -e "sudo apt-get update; sudo apt-get update" --noclose --hold QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-root' QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-root' root@MO-HP-EliteBook-
    – mo97
    Apr 8, 2019 at 13:14
  • @mo97 - I cannot tell from what you posted, is it still not working?
    – slm
    Apr 8, 2019 at 13:15
  • @mo97 - you might want to try using konsole -e "sudo whoami; sudo whoami" --noclose --hold to see what the issue might be more easily.
    – slm
    Apr 8, 2019 at 13:16
  • Done everything you say .. This is the result .. QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-root' QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-root'
    – mo97
    Apr 8, 2019 at 13:25
  • @mo97, You can also test what happens with the following command line, konsole -e "sudo whoami; sudo whoami;bash" -- The final bash will make the konsole window stay instead of close immediately after finishing the previous commands.
    – sudodus
    Apr 8, 2019 at 13:33
0

To send several commands to different terminals simultaneously one easy way could be with byobu:

Press Ctrl+F2 to vertical split, then Shift+F9:

screenshot

screenshot

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .