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

linux 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

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

linux 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 :: bash script to clean up log files in /var/log 
Shell :: openssl check certificate expiration 
Shell :: run shell script in docker build 
Shell :: undo git commit and keep changes 
Shell :: brave installation ubuntu 
Shell :: duplicate file linux 
Shell :: linux rename 
Shell :: kde 144hz 
Shell :: win add to startup 
Shell :: install mpdf laravel 
Shell :: github push local branch to remote 
Shell :: how to delete evicted pod in kubernetes: 
Shell :: install zotero with command line 
Shell :: bash check if executable 
Shell :: curl post form 
Shell :: install express globally 
Shell :: read file line loop in bash 
Shell :: yarn react install 
Shell :: create md5 hash command line 
Shell :: linux command to update nodejs 
Shell :: vijm jump to end of file 
Shell :: macbook gestures stopped working 
Shell :: linux update 
Shell :: Install Git server on Windows 
Shell :: react-darkmode-toggler 
Shell :: Unsupported upgrade request. 
Shell :: merge master to dev branch 
Shell :: start xampp on mac 
Shell :: how to add color in shell script 
Shell :: powershell new item 
ADD CONTENT
Topic
Content
Source link
Name
6+1 =