Question

I am trying a bit of experiments with airmon-ng script in Linux. Meanwhile i want to redirect output of a process "airodump-ng mon0" to a file. I can see the instantaneous output on the screen. The feature of this process is that it won't stop execution(actually it is a script to scan for AP and clients, it will keep on scanning) unless we use ctrl+c. Whenever i try

    airodump-ng mon0 > file.txt

i won't get the output in the file. My primary assumption is that the shell will write it to the file only after completing the execution. But in the above case i stopped the execution(as the execution won't complete).

So to generalize i can't pipe the output of a running process to a file. How can i do that? Or is there any alternative way to stop the execution of the process(for example after 5 seconds) and redirect the current output to a file?

Was it helpful?

Solution

A process may send output to standard output or standard error to get it to the terminal. Generally, the former is for information and the latter for errors, but in some cases, a process may mix them up.

I'm supposing that in your case, the standard error is being used. To get both of these to the output file, you can use:

airmon-ng mon0 > file.txt 2>&1

This says to send standard output to file.txt and to reroute 2 (which is the file id for standard error) into 1 (the file id for standard output) so that it also goes to the file.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top