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 bash 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 :: install rest framework django command ubuntu 
Shell :: how to push existing project to github 
Shell :: docker redis set username and password 
Shell :: install perl 5 on ubuntu 2020 
Shell :: The platform "win32" is incompatible with this module. 
Shell :: rsync exclude 
Shell :: permission denied /dev/ttyusb0 
Shell :: nodejs installation on ubuntu 
Shell :: ssh for github 
Shell :: shell script variable 
Shell :: mkdir powershell 
Shell :: Using git reset to Undo a Merge 
Shell :: sbt install mac 
Shell :: post webhook bash 
Shell :: install composer debian 
Shell :: mac see current path 
Shell :: applescript run from cli 
Shell :: create gitignore files 
Shell :: sudo windows 
Shell :: linux ssh server 
Shell :: string to date in shell script 
Shell :: install rstudio ubuntu 20.04 
Shell :: brew update package 
Shell :: solana create keypair 
Shell :: github api search 
Shell :: chmod a+x 
Shell :: find name file in cmd 
Shell :: jupyter digits 
Shell :: destroy linux with one command 
Shell :: how to push code to bitbucket 
ADD CONTENT
Topic
Content
Source link
Name
7+8 =