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 :: supprimer une branch git 
Shell :: brew install jenv 
Shell :: remove unnecessary npm packages 
Shell :: find command recursive 
Shell :: delete a local and remote git branch 
Shell :: ubuntu start pycharm 
Shell :: rm multiple folders 
Shell :: loop over array of strings bash 
Shell :: To stop all running docker containers 
Shell :: httpd https docker 
Shell :: move files one level up linux 
Shell :: optimize github repo 
Shell :: iptables deny all 
Shell :: instal curl via yum 
Shell :: how to refresh cache on github 
Shell :: how to install mongodb in ubuntu 20.04 lts fossa 
Shell :: grant superuser permission to sudo user ubuntu 
Shell :: install spicetify on windows 
Shell :: anconda install django 
Shell :: forticlient vpn connected but not working 
Shell :: ubuntu reset path 
Shell :: ssh config 
Shell :: how to edit crontab in linux 
Shell :: pip3 install from git 
Shell :: how to get ips of any website 
Shell :: list all user ubuntu server 
Shell :: push to git 
Shell :: git sync branches 
Shell :: updating vscode on ubuntu 
Shell :: how to merge git branch to master 
ADD CONTENT
Topic
Content
Source link
Name
2+9 =