You can use watch -w or –no-linewrap option to turn off line wrapping. Long lines will be truncated instead of wrapped to the next line.
Example:
Create and execute a script that inserts one long line every sec indefinitely:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
## create a script to insert 1 item every 2 second indefinitly cat << 'EOF' > myscript.sh #!/bin/bash > myfile i=1; while : do for j in {100000000..100000050} ; do echo "$i$j$j$j$j$j$j$j$j$j$j$j$j$j$j$j" >> myfile sleep 2 done ((i++)) done EOF ## execute the script in the background chmod +x myscript.sh ./myscript.sh & |
watch -w or –no-linewrap option example:
1 2 3 4 5 6 7 |
watch -w tail myfile ## turn off line wrappin, long line gets truncated ## default watch tail myfile ## long lines gets wrapped. pkill -f "myscript.sh" ## kill myscript.sh rm my* |