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 :: how to add color in text github readme 
Shell :: uninstall node using n 
Shell :: get repository url git cil 
Shell :: find command in unix 
Shell :: update aws amplify cli 
Shell :: install flask auto reload 
Shell :: getopts without argument 
Shell :: bash loop array 
Shell :: dotenv installation 
Shell :: httpd https 
Shell :: how to exit root in linux 
Shell :: ssh key pair github 
Shell :: configure meld as git mergetool ubuntu 
Shell :: installing xlswriter 
Shell :: setup ngrok in windows subsystem for linux 
Shell :: .gitignore not working 
Shell :: ext-dom missing ubuntu 
Shell :: install node on ubuntu 
Shell :: intel driver arch linux 
Shell :: iptable port forward 
Shell :: how to check if command line tools is install 
Shell :: ubuntu move folder to another directory 
Shell :: config vscode terminal to bash default 
Shell :: how to install trello on linux 
Shell :: how to get the ip of a website 
Shell :: list users in ubuntu 
Shell :: delete pid port 
Shell :: how to install from git clone 
Shell :: does git bash have bashrc 
Shell :: merge feature branch into master 
ADD CONTENT
Topic
Content
Source link
Name
6+4 =