There are commands such as top, watch, Airodump-ng, etc, that whenever you run, everything on the terminal change all the time. What I want to do is that run one of theses interactive command and then use pipe to grep something I've been looking for. Take this for instance:

   airodump-ng wlan0 | grep "QQ:AF:00:55:8C:DF"

In this example I am looking for a MAC address, when this MAC turn up, it will appear on screen so that I can grep it.

The problem is that it doesn't work. I have searched a lot to no avail.

  • I still beg to differ; for example, the command top | grep X works just fine on my system (Debian 8). It produces output on X and nothing else at regular (2 seconds) intervals.
    – anon
    Oct 15, 2016 at 10:17
  • interestingly enough it works with top.very strange!maybe the problem is with airodum-ng!
    – Kasra
    Oct 15, 2016 at 10:21
  • Are you sure the search strings are actually present? Pipe the stream into less +F to check this point. You can even search for your terms in less command. Dec 5, 2023 at 16:30

3 Answers 3


doing exactly that, "greping from interactive command", could be hard if not impossible, and if you found a solution, i think it would be rather convoluted.

The way doing this is by learning each command for instance: in airodump-ng you can use filters.

airodump-ng wlan0 --bssid QQ:AF:00:55:8C:DF --essid home_wifi

this will only show APs with the name home_wifi, with that exact bssid.


see also the --line-buffered option of grep; it makes grep execute its test every time its stdin sees a newline

  • 2
    No --line-buffered is for grep's output to be line-buffered like it is when it goes to a terminal device. It doesn't affect the way grep reads and processes its input. Aug 22, 2017 at 11:38
  • sorry, however it works, there's scenarios where long-running-process | grep foo blocks without outputting anything and long-running-process | grep --line-buffered foo outputs stuff as it is written
    – Plato
    Aug 22, 2017 at 19:26
  • 1
    Yes, when grep's stdout is not a tty and when the problem is grep buffering its output. Like in tail -f file | grep . | cat Aug 22, 2017 at 21:14

You can use the command watch for this.

For example:

sudo watch -n 1 "airodump-ng wlan0 | grep "QQ:AF:00:55:8C:DF"
  • I'll test now.I'll tell you the result
    – Kasra
    Oct 15, 2016 at 10:23

You must log in to answer this question.

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