The watch -t, –no-title option turn off the header showing the interval, command, and current time at the top of the display, as well as the following blank line.
Example:
Create and execute a script that inserts 1 item every 2 seconds indefinitely:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
## create a script to insert 1 item every 2 second indefinitly cat << 'EOF' > myscript.sh #!/bin/bash > myfile i=1; while : do echo "$i" >> myfile sleep 2 ((i++)) done EOF ## execute the script in the background chmod +x myscript.sh ./myscript.sh & |
watch -t or –no-title option example:
1 2 3 4 5 6 7 8 9 10 |
## default watch tail myfile ## returns, Every 2.0s: tail myfile cloudaffaire: Fri Feb 4 18:36:46 2022 as header ## watch -t or --no-title option watch -t tail myfile ## only display the output without any additional details pkill -f "myscript.sh" ## kill myscript.sh rm my* |