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

linux command to clean up log files

# 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 :: bash script to clean up log files 
Shell :: linux bash clean up log files in /var/log 
Shell :: how to push existing project to github 
Shell :: strapi run command 
Shell :: download brave linux 
Shell :: install yarn windows 
Shell :: Powershell TLS 
Shell :: kde increase refresh rate 
Shell :: rpm extract 
Shell :: git restore file 
Shell :: how to create alias in linux 
Shell :: tensorflow docker hub 
Shell :: how to remove blank lines in bash 
Shell :: EsLint global installation 
Shell :: install redis 
Shell :: express js 
Shell :: linux terminal color change 
Shell :: chmod add execute permission to useer 
Shell :: echo ros path 
Shell :: tar command 
Shell :: linux add user to group 
Shell :: android uninstall application adb 
Shell :: pip install local directory 
Shell :: remove folder and contents linux 
Shell :: dotnet test 
Shell :: ver particiones montadas linux 
Shell :: close terminal commang 
Shell :: aws cli 
Shell :: error: required key missing from keyring 
Shell :: git undo unstaged changes to one file 
ADD CONTENT
Topic
Content
Source link
Name
2+9 =