Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SHELL

linux bash how to clear log files debian ubuntu centos

# Run as root, of course.
# For sh shells:
cd /var/log
: > messages
: > wtmp
echo "Log files cleaned up."

# For bash shells:
cd /var/log
> messages
> wtmp
echo "Log files cleaned up."

# This is a better version, does the same thing, less redundancy.

# visit this link for detailed explanation:
https://superuser.com/questions/849413/why-would-you-cat-dev-null-var-log-messages
Source by superuser.com #
 
PREVIOUS NEXT
Tagged: #linux #bash #clear #log #files #debian #ubuntu #centos
ADD COMMENT
Topic
Name
2+4 =