2

I would like to display the output table of the arp command every 30 seconds, so that I can monitor Address Resolution Protocol traffic on my network.

Unfortunately arp doesn't have such option. It only prints the current content of the table once, like this:

Address                  HWtype  HWaddress           Flags Mask            Iface
192.168.0.103            ether   48:e2:44:d5:7a:97   C                     eth0
192.168.0.1              ether   c8:3a:35:49:77:48   C                     eth0

So I usually end up running arp several times manually to detect any changes in the table entries, which is not very sophisticated.

In order to automate this task, I read that the watch command allows to repeat commands automatically (1, 2, 3). Therefore I prepended watch -n 30 to arp like this:

watch -n 30 arp

However, when I run it I don't get any kind of output. The table is not even printed once.

Why is that? How can I solve this?

This answer shows a working example with nmcli dev, so I see no reason why this should not be possible to do with arp.

I am using Xubuntu 16.04 Xenial Xerus.

codeaviator
  • 1,757

1 Answers1

2

It should work and it indeed works here exactly as you entered it:

watch -n 30 arp

The only thing I can think of would be to look at the results of the command "export" and make sure your display isn't set to something funky.

I ran the watch command from a standard terminal shell that comes with the standard Ubuntu distribution. Nothing special here...

As a test you could try forcing an output redirect:

watch -n 5 arp >> test_file

jones0610
  • 2,157