[Linux] how to view today log at 4 pm ?

in Bash script or Linux terminal


grep "$(date +"%b %e 16")" /var/log/syslog

in Python


from datetime import datetime

from pathlib import Path

tme ='%b %e')+' 16'

log = Path('/var/log/syslog').read_text().splitlines()

print(*[i for i in log if tme in i], sep = '\n')

If you want to get new posts, make sure to subscribe to Value In Brief by Email.