How to use the watch command to update a terminal every 2 seconds with an updating file.

Posted: December 20, 2013. At: 11:27 AM. This was 4 years ago. Post ID: 6763
Page permalink.
WordPress uses cookies, or tiny pieces of information stored on your computer, to verify who you are. There are cookies for logged in users and for commenters. These cookies expire two weeks after they are set.

I am using this command to search the Internet for open ports on port 80 with nmap.

sudo nmap -sS -iR 0 -p 80 -oG nmap.grepable

Then I use this command in another terminal tab to view the updating file. This will be updated every two seconds with new file content.

watch cat nmap.grepable

This is a good way to monitor files for any changes.

This is another good way. This command will constantly monitor the /var/log/dmesg file for any new kernel messages.

watch tail -n 10 /var/log/dmesg

This command will watch for new kernel messages.

watch tail /var/log/kern.log

The watch command is a very useful tool to run in a spare xterm to monitor your logfiles. Give these tricks a try and see how useful they really are.

1 responses to “How to use the watch command to update a terminal every 2 seconds with an updating file.

Leave a Reply