logrotate command not found

In this troubleshooting guide we learn how to fix logrotate command not found error message

Introduction

When you run more command in linux terminal / console, you get the following error message

logrotate: command not found

or when using sudo you get the following error message

sudo: logrotate: command not found

Solutions to logrotate: command not found

How To Fix logrotate: command not found in Ubuntu / Debian / Kali Linux / Raspbian

In Ubuntu logrotate is provided by logrotate package.

logrotate is:

The logrotate utility is designed to simplify the administration of log files on a system which generates a lot of log files. Logrotate allows for the automatic rotation compression, removal and mailing of log files. Logrotate can be set to handle a log file daily, weekly, monthly or when the log file gets to a certain size. Normally, logrotate runs as a daily cron job.

To fix this problem, we can install more using the command below.

sudo apt-get -y install logrotate

This command might take some time to finish depending on your machine internet connection.

You can also use apt command to install logrotate.

sudo apt -y install logrotate

Or if you have aptitude installed you can use the following command.

sudo aptitude install logrotate

Summary

In this tutorial we learn how to fix logrotate command not found error in Ubuntu / Debian / Kali Linux or Raspbian distribution.