|
|
To completely clear a log file, use a command like this:
cp /var/adm/sulog /var/adm/sulog.old
> /var/adm/sulog
To delete all but the last 50 lines:
tail -50 /var/adm/sulog > /var/tmp/sulog
mv /var/tmp/sulog > /var/adm/sulog
This creates a
temporary file, and then moves the temporary file to
/var/adm/sulog, thus truncating the file to the
most recent entries.
Examine log files for contents before truncating them.
To monitor new information that is currently being
appended to a system log file, enter:
tail -f /var/adm/sulog
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.