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 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 :: mkdir rm folder 
Shell :: how to update ubuntu from terminal 
Shell :: strapi run command 
Shell :: brave on linux 
Shell :: how to view hidden files and folders on terminal 
Shell :: find command in linux 
Shell :: git pull --tags origin main remote: Repository not found. 
Shell :: linux recover deleted file 
Shell :: ssh key github 
Shell :: sshd: no hostkeys available -- exiting. 
Shell :: git stash pop single file 
Shell :: git reset to undo a merge 
Shell :: current time linux 
Shell :: git new branch 
Shell :: docker compose stop and start only specific 
Shell :: mac see current path7 
Shell :: mysql2 install error ruby 
Shell :: copy from server to local scp 
Shell :: angular cli interface generate 
Shell :: postgres run query from command line 
Shell :: bash not equal 
Shell :: sh script options 
Shell :: laravel new project in install 
Shell :: change directory, files and sub-directories owner in linux 
Shell :: how to get environment variables in powershell 
Shell :: regex match + n lines 
Shell :: how to install wine in ubuntu 18.04 
Shell :: git overwrite remote files 
Shell :: laptop slow performance linux ubuntu 
Shell :: yarn global 
ADD CONTENT
Topic
Content
Source link
Name
6+7 =