English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

Linux logrotate command

Linux Command大全

The Linux logrotate command is used to manage log files.

Using the logrotate command, you can easily manage the log files generated by the system. It provides automatic replacement, compression, deletion, and mailing of log files. Each log file can be set to be processed daily, weekly, or monthly, and can also be processed immediately when the file is too large. You must edit the configuration file yourself, and the default configuration file is stored in/In the etc directory, the file name is logrotate.conf.

Syntax

logrotate [-?dfv][-s <status file>][--usage][Configuration File]

Parameter Description:

  • -? or--help  Online help.
  • -d or--debug  Display the detailed execution process of the command, which is convenient for troubleshooting or understanding the program execution status.
  • -f or--force  Force the start of the log file maintenance operation, even if the logrotate command thinks there is no need.
  • -s<status file> or--state=<status file>  Use the specified status file.
  • -v or--version  Display the execution process of the command.
  • -usage  Display the basic usage of the command.

Online Examples

Specify the log file

# logrotate /root/log.config

Linux Command大全