- Use watch with -n to watch a command ever 2 seconds. e.g. To watch top command with first 12 lines every 2 seconds:
watch -n 2 '/usr/bin/top -b -n 1 -c | head -12'
- Check port availability every second
watch -n 1 ‘nc -vz localhost 22; date’
watch -n 2 '/usr/bin/top -b -n 1 -c | head -12'