To clear a log file and retain the file permissions:
Copy the file to a new filename.
For example:
cp /usr/adm/messages /usr/adm/messages.old
Clear the file with one of these commands:
Bourne or Korn shell:
> /usr/adm/messages
C shell:
cat /dev/null > /usr/adm/messages
To monitor new information that is currently being
appended to system log files, enter:
tail -f /usr/adm/messages
The -f (follow) option to the
tail(C)
command prints the last 10 lines of the file, followed by
any lines that are appended to the file between the time
you initiated and stopped (with <Del>) the tail command.