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 :: powershell get OS 
Shell :: run shell script in docker build 
Shell :: linux samba service 
Shell :: git delete local branch 
Shell :: hibernate command 
Shell :: enable apache2 site 
Shell :: hostname change inux 
Shell :: git log 
Shell :: generate ssh key in github 
Shell :: could not open lock file "/tmp/.s.PGSQL.5432.lock": Permission denied 
Shell :: taskkill cmd 
Shell :: Find last digit of a number in c# 
Shell :: create multiple copies in linux of file 
Shell :: copy files between servers 
Shell :: boostrap install angular 
Shell :: mac see current path2 
Shell :: gimp apt 
Shell :: what version of linux am i running 
Shell :: remove gitignore files 
Shell :: docker compose install centos 8 
Shell :: replace word in file linux command 
Shell :: how to delete files from command line 
Shell :: rename local branch github 
Shell :: The application could not be installed: INSTALL_FAILED_CONFLICTING_PROVIDER 
Shell :: Server unable to read htaccess file 
Shell :: jetpack compose 
Shell :: nano go to line 
Shell :: apt vs apt get 
Shell :: mono-complete arch 
Shell :: yarn add global 
ADD CONTENT
Topic
Content
Source link
Name
8+3 =