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 command 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 :: linux bash how to clear log files debian ubuntu centos 
Shell :: remove cache package arch 
Shell :: combine commands bash 
Shell :: find command 
Shell :: ngrok minecraft server 
Shell :: php.ini ubuntu 
Shell :: shell script while loop example 
Shell :: E: Unable to acquire the dpkg frontend lock (/var/lib/dpkg/lock-frontend), is another process using it? 
Shell :: linux get user uid 
Shell :: httpd ssl docker 
Shell :: undo git pull origin master into feature branch 
Shell :: youtube-dl ubuntu 
Shell :: -bash: /bin/rm: Argument list too long inodes 
Shell :: print last terminal commands 
Shell :: nginx file permission 
Shell :: list all node versions mac 
Shell :: rsync with ssh key 
Shell :: Available platform plugins are: xcb, eglfs, linuxfb, minimal, minimalegl, offscreen, vnc, wayland-egl, wayland, wayland-xcomposite-egl, wayland-xcomposite-glx. 
Shell :: linux install nvm 
Shell :: check current branch github 
Shell :: find file in linux with regex 
Shell :: how to get only a list of size of files bash 
Shell :: install slack ubuntu 
Shell :: sourcetree change commit message not pushed 
Shell :: git github account change 
Shell :: swagger installation 
Shell :: linux show ssh users 
Shell :: push local branch to remote 
Shell :: install ionic 6 
Shell :: ls by size 
ADD CONTENT
Topic
Content
Source link
Name
5+6 =