Questions tagged [watch]
watch will execute a program periodically, displaying the output.
135 questions
2 votes
1 answer
126 views
Why does script or watch output look weird in saved text files
I use the script command to save the whole session, but the output in the text file is something weird, and I opened it with the cat command in the terminal, and everything became ok. How can I save ...
1 vote
1 answer
59 views
watch with piped command executes differently than command itself
What am I doing wrong setting up following watch command? This works: ls -ltr ~/meteofetcher/data/metar/2024/12 | tail -10 | awk '{ print $9 }' | xargs -I {} grep 'LSZH' {} But this watch "ls -...
-1 votes
1 answer
477 views
Watch command: Updates only periodically, not event-based? (Example: Every 2 seconds - every time file x gets saved)
What I'd like to have: Running a command y with watch command and have watch command update only as soon as output of command y has changed. Imagine a bash script with 3 lines of echo output Hello ...
1 vote
1 answer
433 views
How can I get colored output of `systemd` commands run with `watch` inside xterm?
Somehow I'm unable to get this working with color output, it works but no colors are shown. I'm currently using these alias'es in my bash shell: alias Xterm='xterm -geometry 132x60 +dc +cm -e ' alias ...
4 votes
1 answer
4k views
How to run bash function in "watch" command?
Say I have a function f defined in my bashrc function f() { date } I want to run following command to monitor the output watch f. The command failed with "sh: f: command not found". watch ...
1 vote
1 answer
107 views
`watch -n 100 'sh script.sh >> /path/to/output/output.txt` doesn't write to output.txt?
I'm currently executing the following: watch -n 100 'sh script.sh >> /path/to/output/output.txt' & It's been running for 30 minutes (I can verify with ps -ef | grep watch), however there's ...
1 vote
0 answers
56 views
how to wrap command with many quotes into watch properly?
I have such a bash command ... psql -c "SELECT datname FROM pg_database WHERE datname LIKE 'efa%' OR datname LIKE 'geocms%';" and am wondering how to wrap this into watch -cd "<...
0 votes
1 answer
916 views
terminal timer with end time given through bash
so I had the idea of making a bash function that takes in a time in hh:mm:ss (24 hour format) and makes a timer till that time kinda like a one time alarm while also showing how much time is left I ...