This question already has an answer here:

I want to create a shortcut to run a command with keyboard shortcut But when I press "alt+ctrl+a" terminal open and immediately close.

Please help me to edit below command for prevent from close after ran it.

gnome-terminal -e "vnstat -ru -i wlan0 -h"

marked as duplicate by αғsнιη, LnxSlck, muru, v2r, bcbc Oct 21 '14 at 15:29

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • See: unix.stackexchange.com/q/155955/70524 – muru Oct 21 '14 at 8:11
  • The answer is awesome! Please don't delete it. – Daniyal Oct 21 '14 at 16:39
  • Which answer are you talking of? – muru Oct 21 '14 at 16:41
  • @muru chaos answer. Although I don't know, I'm just a newbie. – Daniyal Oct 21 '14 at 16:54
  • That is pretty much what this two year old answer is: askubuntu.com/a/176249/158442 Anyway, this probably won't get deleted. – muru Oct 21 '14 at 16:59

Try it with this command instead:

gnome-terminal -e "bash -c 'vnstat -ru -i wlan0 -h; exec bash'"

The exec bash part at the end causes to start a bash that replaces the current shell (also a bash).


create a keyboard shortcut with the following command : gnome-terminal . Thats it.

  • Also wants run a command – αғsнιη Oct 21 '14 at 8:55
  • What do you mean? This command "gnome-terminal" opens your terminal. – Julien Chau Oct 21 '14 at 9:03
  • 1
    Read the OP's question. He wants open a terminal and run his command altogether not just open terminal alone. – αғsнιη Oct 21 '14 at 9:05

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