Search
 
SCRIPT & CODE EXAMPLE
 

SHELL

linux bash script to clean up log files

# 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
Comment

bash script to clean up log files in /var/log

# Run as root, of course.

cd /var/log
cat /dev/null > messages
cat /dev/null > wtmp
echo "Log files cleaned up."
# for detailed exaplanations on this, visit this link:
# https://superuser.com/questions/849413/why-would-you-cat-dev-null-var-log-messages

# /var/log:
# path where logs for the system, running processes etc are usually saved

# cat /dev/null > messages command:
# opens a null file in path /dev/null
# pushes /dev/null file into messages file

# cat /dev/null > wtmp : this is basically the same

Comment

PREVIOUS NEXT
Code Example
Shell :: linux bash clean up log files in /var/log 
Shell :: html2canvas 
Shell :: windows cmd remove a not empty directory 
Shell :: download composer 
Shell :: print grep output in one line 
Shell :: cp all files except one 
Shell :: windows del force yes 
Shell :: td-agent restart 
Shell :: ssh key gen 
Shell :: kivy install ubuntu 20 
Shell :: git squash commits merge 
Shell :: how to open teminal pycharm 
Shell :: install polar linux 
Shell :: nuxt new project npm 
Shell :: install docker linux 
Shell :: docker login command line push 
Shell :: rails reset gemfile.lock 
Shell :: view permissions linux 
Shell :: start logstash 
Shell :: git compare two branches 
Shell :: pm2 logs log time 
Shell :: postinstall docker 
Shell :: ssh permission denied publickey 
Shell :: tar exclude multiple directories 
Shell :: nvcc not working after installing cuda 
Shell :: download docker ubuntu 
Shell :: git remove file from commit 
Shell :: ubuntu install docker 
Shell :: connectify alternative for linux 
Shell :: torch 1.1.0 install 
ADD CONTENT
Topic
Content
Source link
Name
9+8 =