Results 1 to 2 of 2
I have a script where I want to run tcpdump and then immediately run another command
however, tcpdump will cause the shell pause/hang
so the following command lines will have ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
- 10-02-2012 #1Just Joined!
- Join Date
- May 2012
- Posts
- 82
how to run tcpdump on background?
I have a script where I want to run tcpdump and then immediately run another command
however, tcpdump will cause the shell pause/hang
so the following command lines will have no chance to run
even if I use &, it doesn't help
are there any solutions?
thanks
- 10-03-2012 #2Trusted Penguin
- Join Date
- May 2011
- Posts
- 3,680
use GNU screen, i'd say. it is a terminal emulator that allows you to create a virtual terminal that you can run bash scripts and commands in and throw it in the background, great for stuff like this, e.g.:
this will start a screen named "TCPDump" and run it in the background (-dm) and the command passed to it will be "tcpdump -i wlan0".Code:screen -S "TCPDump" -dm tcpdump -i wlan0
you can see running screen sessions with:
and then reattach to the pid or the name of a session (listed in the "screen -ls" command) with, e.g.:Code:screen -ls
check out the man page ("man screen") to learn the many options available in screen.Code:screen -r TCPDump


Reply With Quote
