Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to open a new terminal when i enter a user-defined command in linux. Means for an example,when i type a command tcpdump in terminal and this will open a new session terminal for the tcpdump.

So in newly opened terminal, for capturing the packet, i have to write only -i eth0 and not tcpdump -i eth0. The new terminal will internally take the command tcpdump.

So will these be possible?

share|improve this question

migrated from Oct 8 '12 at 11:33

This question came from our site for professional and enthusiast programmers.

How do you connect to a Linux session right now? For example, do you use a GUI with xterm, or do you connect using an emulator on Windows? – cdarke Oct 8 '12 at 8:33

I'm going to assume that you want to run the command in a new terminal window on your (Linux) desktop. Most terminal emulators seem to have an option -e for running commands, so you could do something like this:

urxvt -e $SHELL -c 'read -p "Options: " OPTS; tcpdump $OPTS' &

Replace urxvt with aterm, xterm, Konsole or whatever terminal emulator you're using.

If you want the window to remain open after the command finishes, you have to take additional steps (urxvt has an option -hold for this, but other terminal emulators don't).

share|improve this answer

You could get a nice interpreter interface using rlwrap (which you can probably install through your distribution's package manager).

while rlwrap -o -P "tcpdump " -C tcpdump sh; do :; done

This will give you a shell where the command-line line already has "tcpdump " at the beginning. It will also keep a history of the commands you previously ran using the command.

Run exit 1 to quit the shell.

You could use Ansgar Wiechers' method to run the command in a new terminal window.

share|improve this answer

You could try terminator, then splitting windows per command or modify some script I wrote to ssh per server, to split per command would need some work for that to happen but all possible

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.