Rotate logs now

Force log rotation without waiting for the schedule.

logrotate -f /etc/logrotate.conf

tool
linux133 commands
tags
linuxlogs

More linux commands

  • for u in $(cut -f1 -d: /etc/passwd); do crontab -l -u $u 2>/dev/null | grep -v '^#' | sed "s|^|$u: |"; done

    Print the active crontab lines of every user, skipping comments.

  • systemd-analyze calendar '*/5 * * * *'

    Parse a schedule and show when it runs next. Note: systemd has its own calendar format and does not understand cron syntax.

  • command > /tmp/out.log 2> /tmp/err.log

    Write stdout and stderr to separate files.

  • command 2>&1 | tee /tmp/all.log

    Send stdout and stderr to a file and to the screen at the same time.

  • grep -rl 'old_string' /etc/ | xargs sed -i 's/old_string/new_string/g'

    Find files that contain the text and replace it directly in them.

all 133 linux commands