How to delete logs in linux

青灯夜游
Release: 2021-12-21 15:12:13
Original
25814 people have browsed it

Method to delete logs: 1. Use the "cat /dev/null > log file name" command; 2. Use the ": > log file name" command; 3. Use "> log file name" " command; 4. Use the "echo "" > log file name" command; 5. Use the "echo > log file name" command.

How to delete logs in linux

The operating environment of this tutorial: linux5.9.8 system, Dell G3 computer.

The database log (alter.log listener.log log.xml) generally cannot be deleted directly. It is best to just clear the content. Here are 5 ways to clear the log:

First type: cat /dev/null > filename

cat /dev/null > 日志文件名
Copy after login

Second type:: > ; filename

: >  日志文件名
Copy after login

##Third type:> filename

>  日志文件名
Copy after login

Fourth: echo "" > filename

echo "" > 日志文件名
Copy after login

The fifth way: echo > filename

echo > 日志文件名
Copy after login

The above 1/2/3 methods can clear the file, and the file The size is 0

and the following 4/5 method results in a "\0" in the text. After clearing, the file size is 1

Related recommendations: "

Linux Video Tutorial

The above is the detailed content of How to delete logs in linux. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template