Search
 
SCRIPT & CODE EXAMPLE
 

SHELL

linux bash command 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

# 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 clear log file space 
Shell :: force pull git 
Shell :: apt search installed package 
Shell :: while loop bash 
Shell :: install openvino ubuntu 
Shell :: sh is null if 
Shell :: docker execute command in container 
Shell :: git ignore all files within a directory 
Shell :: linux get user id 
Shell :: httpd ssl 
Shell :: grep nth line 
Shell :: how to check the parent branch in git 
Shell :: vue command not found 
Shell :: linux convert mp3 to ogg 
Shell :: ubuntu 755 and 644 
Shell :: how to run eslint on the whole project 
Shell :: makefile ifeq or 
Shell :: install storybook react 
Shell :: git alias list 
Shell :: git see local changes 
Shell :: git no ssl verify 
Shell :: ubuntu server 20.04 list users 
Shell :: install slack ubuntu/linux 
Shell :: sourcetree change commit message 
Shell :: git initialize repository 
Shell :: symfony install website skeleton 
Shell :: install drush ubuntu 20.04 
Shell :: git new branch push to remote 
Shell :: view live log linux 
Shell :: hydra use find password cracker 
ADD CONTENT
Topic
Content
Source link
Name
8+7 =