T
T
Talyan2020-12-11 20:29:23
linux
Talyan, 2020-12-11 20:29:23

Is it possible to complete the watch command argument in linux?

I execute the command:

sudo watch -n1 -d -t tail -n30  /var/log/fail2ban.log


But, I would like watch to perform not just but If you writetail -n30 /var/log/fail2ban.log
tail -n30 /var/log/fail2ban.log | grep ban

sudo watch -n1 -d -t tail -n30  /var/log/fail2ban.log | grep ban

then nothing works.

Clarifying the question, I will try to explain it in a simpler way: how to execute a grep command in watch?

Thank you.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
Rsa97, 2020-12-11
@flapflapjack

sudo watch -n1 -d -t 'tail -n30 /var/log/fail2ban.log | grep ban'

And why not use the tracking mode of tail itself?
tail -f /var/log/fail2ban.log | grep ban

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question