Posted: . At: 11:27 AM. This was 10 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.

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

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 thought on “How to use the watch command to update a terminal every 2 seconds with an updating file.”

Leave a Reply to Alireza Cancel reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.