how to view last 1 hour log in Linux ?

in Bash script or Linux terminal


journalctl --since "1 hour ago"

in Python


from datetime import datetime, timedelta

from re import match, compile

tme = [( - timedelta(minutes=i))

    .strftime("%b %e %H:%M") for i in range(60)]

compose = compile('^[A-Za-z]{3}\s{2}\d{1,2}\s\d{1,2};\d{1,2}')

with open('/var/log/syslog') as log:

    for line in log:

        if compose.match(line).group() in tme:


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